aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-01-31 09:59:15 +0100
committerGuido Günther <agx@sigxcpu.org>2012-01-31 11:57:33 +0100
commitb4e9a28256b27afb8f8c23fe1a73d1e2ede0b559 (patch)
tree69e27c285ac0942024c697dca33bffc0f022e7d9
parentcd37502b4520106407a49c1f63b72bde62c046f0 (diff)
GitRepository: Use _git_inout() in __init__()
to avoid misleading error message
-rw-r--r--gbp/git/repository.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index f63dd42..adf23a7 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -47,20 +47,22 @@ class GitRepository(object):
def _check_bare(self):
"""Check whether this is a bare repository"""
- out, ret = self._git_getoutput('rev-parse', ['--is-bare-repository'])
+ out, dummy, ret = self._git_inout('rev-parse', ['--is-bare-repository'],
+ capture_stderr=True)
if ret:
raise GitRepositoryError(
"Failed to get repository state at '%s'" % self.path)
- self._bare = False if out[0].strip() != 'true' else True
+ self._bare = False if out.strip() != 'true' else True
self._git_dir = '' if self._bare else '.git'
def __init__(self, path):
self._path = os.path.abspath(path)
self._bare = False
try:
- out, ret = self._git_getoutput('rev-parse', ['--show-cdup'])
- if ret or out not in [ ['\n'], [] ]:
- raise GitRepositoryError("No Git repository at '%s'" % self.path)
+ out, dummy, ret = self._git_inout('rev-parse', ['--show-cdup'],
+ capture_stderr=True)
+ if ret or out.strip():
+ raise GitRepositoryError("No Git repository at '%s': '%s'" % (self.path, out))
except GitRepositoryError:
raise # We already have a useful error message
except: