diff options
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 6 |
1 files changed, 5 insertions, 1 deletions
| @@ -3835,7 +3835,11 @@ class Project: | |||
| 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 | try: | 3837 | try: |
| 3838 | return self.rev_parse("--symbolic-full-name", HEAD) | 3838 | symbolic_head = self.rev_parse("--symbolic-full-name", HEAD) |
| 3839 | if symbolic_head == HEAD: | ||
| 3840 | # Detached HEAD. Return the commit SHA instead. | ||
| 3841 | return self.rev_parse(HEAD) | ||
| 3842 | return symbolic_head | ||
| 3839 | except GitError as e: | 3843 | except GitError as e: |
| 3840 | path = self.GetDotgitPath(subpath=HEAD) | 3844 | path = self.GetDotgitPath(subpath=HEAD) |
| 3841 | raise NoManifestException(path, str(e)) | 3845 | raise NoManifestException(path, str(e)) |
