aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-10-29 16:08:47 +0200
committerGuido Günther <agx@sigxcpu.org>2011-10-30 13:36:09 +0100
commitea588a57e4588b4d676304b521c7695b0c2d9121 (patch)
tree549c81aa077d13f13adae7ce6c038f3bcafb1ace
parentbf9e3bde8a53b1d8f62a30f10c9cc8c976e02cd8 (diff)
GitRepository: handle bare repos and errors in is_clean()
-rw-r--r--gbp/git.py9
-rw-r--r--tests/test_GitRepository.py2
2 files changed, 9 insertions, 2 deletions
diff --git a/gbp/git.py b/gbp/git.py
index d6dddd0d..ce4d1338 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -551,14 +551,19 @@ class GitRepository(object):
and Git's status message
@rtype: C{tuple}
"""
+ if self.bare:
+ return (True, '')
+
clean_msg = 'nothing to commit'
- out = self.__git_getoutput('status')[0]
+ out, ret = self.__git_getoutput('status')
+ if ret:
+ raise GbpError("Can't get repository status")
ret = False
for line in out:
if line.startswith('#'):
continue
if line.startswith(clean_msg):
- ret = True
+ ret = True
break
return (ret, "".join(out))
diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py
index 34b96604..55bf9cbe 100644
--- a/tests/test_GitRepository.py
+++ b/tests/test_GitRepository.py
@@ -343,6 +343,8 @@ def test_create_bare():
True
>>> bare.is_empty()
True
+ >>> bare.is_clean()
+ (True, '')
"""
def test_teardown():