adjust is_clean for git 1.6
authorGuido Guenther <agx@sigxcpu.org>
Fri, 26 Sep 2008 14:55:03 +0000 (16:55 +0200)
committerGuido Guenther <agx@sigxcpu.org>
Fri, 26 Sep 2008 14:55:03 +0000 (16:55 +0200)
when tracking a remote branch it prints:

\# On branch debian
\# Your branch is ahead of 'origin/master' by 1 commit.
\#
nothing to commit (working directory clean)

so check the 4th line of output too.

Closes: #500238

gbp/git_utils.py

index d9307e7..204e262 100644 (file)
@@ -71,12 +71,17 @@ class GitRepository(object):
         self.__check_path()
         clean_msg = 'nothing to commit'
         out = self.__git_getoutput('status')[0]
-        if out[0].startswith('#') and out[1].strip().startswith(clean_msg):
-            ret = True
+        ret = False
+        if out[0].startswith('#'):
+            try:
+                if out[1].strip().startswith(clean_msg):
+                    ret = True
+                elif out[3].strip().startswith(clean_msg):
+                    ret = True
+            except IndexError:
+                pass
         elif out[0].strip().startswith(clean_msg): # git << 1.5
             ret = True
-        else:
-            ret = False
         return (ret, "".join(out))
 
     def index_files(self):