summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-05-02 22:20:02 +0200
committerGuido Günther <agx@sigxcpu.org>2013-05-02 22:20:02 +0200
commit2eed043b8df9f83a979bfd5472d08f385976c4f6 (patch)
tree2c3dbd933c943f54d16cac58d7bc00f2afdcb445
parente854b1b7a7cb134e79869d424d5342fba38c01d0 (diff)
GitRepository Use _git_inout in get_branch
to suppress the confusiong "fatal: ref HEAD is not a symbolic ref". We alrady put out a more descriptive error message. This makes using --ignore-branch look far less dangerous.
-rw-r--r--gbp/git/repository.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 8f87854f..740a3d0c 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -301,11 +301,14 @@ class GitRepository(object):
@return: current branch
@rtype: C{str}
"""
- out, ret = self._git_getoutput('symbolic-ref', [ 'HEAD' ])
+ out, dummy, ret = self._git_inout('symbolic-ref', [ 'HEAD' ],
+ capture_stderr=True)
if ret:
+ # We don't append stderr since
+ # "fatal: ref HEAD is not a symbolic ref" confuses people
raise GitRepositoryError("Currently not on a branch")
- ref = out[0][:-1]
+ ref = out.split('\n')[0]
# Check if ref really exists
failed = self._git_getoutput('show-ref', [ ref ])[1]
if not failed: