diff options
| -rw-r--r-- | project.py | 14 |
1 files changed, 3 insertions, 11 deletions
| @@ -3834,19 +3834,11 @@ class Project: | |||
| 3834 | 3834 | ||
| 3835 | def GetHead(self): | 3835 | def GetHead(self): |
| 3836 | """Return the ref that HEAD points to.""" | 3836 | """Return the ref that HEAD points to.""" |
| 3837 | path = self.GetDotgitPath(subpath=HEAD) | ||
| 3838 | try: | 3837 | try: |
| 3839 | with open(path) as fd: | 3838 | return self.rev_parse("--symbolic-full-name", HEAD) |
| 3840 | line = fd.readline() | 3839 | except GitError as e: |
| 3841 | except OSError as e: | 3840 | path = self.GetDotgitPath(subpath=HEAD) |
| 3842 | raise NoManifestException(path, str(e)) | 3841 | raise NoManifestException(path, str(e)) |
| 3843 | try: | ||
| 3844 | line = line.decode() | ||
| 3845 | except AttributeError: | ||
| 3846 | pass | ||
| 3847 | if line.startswith("ref: "): | ||
| 3848 | return line[5:-1] | ||
| 3849 | return line[:-1] | ||
| 3850 | 3842 | ||
| 3851 | def SetHead(self, ref, message=None): | 3843 | def SetHead(self, ref, message=None): |
| 3852 | cmdv = [] | 3844 | cmdv = [] |
