summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gbp/git/repository.py11
-rw-r--r--tests/test_GitRepository.py4
2 files changed, 10 insertions, 5 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index 1c8ea9c..b1e7795 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1349,10 +1349,15 @@ class GitRepository(object):
args.append(since)
args.append('--')
- commits, ret = self._git_getoutput('log', args)
+ stdout, stderr, ret = self._git_inout('log', args,
+ capture_stderr=True)
if ret:
- raise GitRepositoryError("Error grepping log for %s" % regex)
- return [ commit.strip() for commit in commits[::-1] ]
+ raise GitRepositoryError("Error grepping log for %s: %s" %
+ (regex, stderr[:-1]))
+ if stdout:
+ return [ commit.strip() for commit in stdout.split('\n')[::-1] ]
+ else:
+ return []
def get_subject(self, commit):
"""
diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py
index 37b50f8..7365dd8 100644
--- a/tests/test_GitRepository.py
+++ b/tests/test_GitRepository.py
@@ -695,7 +695,7 @@ def test_gc():
>>> repo.collect_garbage()
"""
-def test_grep():
+def test_grep_log():
"""
Test grepping through commit messages
@@ -714,7 +714,7 @@ def test_grep():
>>> repo.grep_log('foo', 'doesnotexist')
Traceback (most recent call last):
...
- GitRepositoryError: Error grepping log for foo
+ GitRepositoryError: Error grepping log for foo: fatal: bad revision 'doesnotexist'
"""
def test_is_ff():