From 9bb73b46d2f215dc70482e55311a64debeca4d6e Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 11 Mar 2011 22:18:27 +0100 Subject: git: improve error handling for commit_tree Git-Dch: Ignore --- gbp/git.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'gbp') diff --git a/gbp/git.py b/gbp/git.py index cf85f0a0..dc648a12 100644 --- a/gbp/git.py +++ b/gbp/git.py @@ -64,9 +64,7 @@ class GitRepository(object): stdout=subprocess.PIPE, env=env) (stdout, stderr) = popen.communicate(input) - if popen.returncode: - stdout = None - return stdout + return stdout, stderr, popen.returncode def base_dir(self): """Base of the repository""" @@ -393,8 +391,11 @@ class GitRepository(object): args = [ tree ] for parent in parents: args += [ '-p' , parent ] - sha1 = self.__git_inout('commit-tree', args, msg, extra_env).strip() - return sha1 + sha1, stderr, ret = self.__git_inout('commit-tree', args, msg, extra_env) + if not ret: + return sha1.strip() + else: + raise GbpError, "Failed to commit tree: %s" % stderr def commit_dir(self, unpack_dir, msg, branch, other_parents=None, author={}, committer={}): -- cgit v1.2.3