summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rwxr-xr-xproject.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/project.py b/project.py
index b41a57cf..51160a94 100755
--- a/project.py
+++ b/project.py
@@ -866,10 +866,17 @@ class Project(object):
866 @property 866 @property
867 def CurrentBranch(self): 867 def CurrentBranch(self):
868 """Obtain the name of the currently checked out branch. 868 """Obtain the name of the currently checked out branch.
869 The branch name omits the 'refs/heads/' prefix. 869
870 None is returned if the project is on a detached HEAD. 870 The branch name omits the 'refs/heads/' prefix.
871 None is returned if the project is on a detached HEAD, or if the work_git is
872 otheriwse inaccessible (e.g. an incomplete sync).
871 """ 873 """
872 b = self.work_git.GetHead() 874 try:
875 b = self.work_git.GetHead()
876 except NoManifestException:
877 # If the local checkout is in a bad state, don't barf. Let the callers
878 # process this like the head is unreadable.
879 return None
873 if b.startswith(R_HEADS): 880 if b.startswith(R_HEADS):
874 return b[len(R_HEADS):] 881 return b[len(R_HEADS):]
875 return None 882 return None