summaryrefslogtreecommitdiffhomepage
path: root/gbp/git/repository.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-10-09 11:30:32 +0200
committerGuido Günther <agx@sigxcpu.org>2016-10-09 13:14:11 +0200
commit55e8c8fa32972402d47e9e83df5a8bfa663ce825 (patch)
treec1c193b9215faf7f2b518ed1dfa94a9fcc4f1576 /gbp/git/repository.py
parent53f9f401245195d385f024f71695674fe61f6602 (diff)
GitRepository.list_submodules: use _git_inout
and check exit status This silences another spurious output to stderr in test_buildpackage_rpm and makes sure we fail on the first operation on the nonexistent tree (repo.list_submodules) instead of the second (repo.archive) since the former ignored the exit status so far.
Diffstat (limited to 'gbp/git/repository.py')
-rw-r--r--gbp/git/repository.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index bf5d528f..88b4c9ea 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -1840,9 +1840,17 @@ class GitRepository(object):
if recursive:
args += ['-r']
- out, ret = self._git_getoutput('ls-tree', args, cwd=path)
- for line in out:
- mode, objtype, commit, name = line[:-1].split(None, 3)
+ out, err, ret = self._git_inout('ls-tree',
+ args,
+ cwd=path,
+ capture_stderr=True)
+ if ret:
+ raise GitRepositoryError("Failed to list submodules of %s: %s" %
+ (treeish, err.strip()))
+ for line in out.split('\n'):
+ if not line:
+ continue
+ mode, objtype, commit, name = line.split(None, 3)
# A submodules is shown as "commit" object in ls-tree:
if objtype == "commit":
nextpath = os.path.join(path, name)