From e9f8f159ebad405b2c08aa75f735146bb8e216ef Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 8 Apr 2015 11:00:32 +0200 Subject: fix(remote): allow to raise during push/fetch Do not swallow non-zero exit status during push and fetch unless we managed to parse head information. This behaviour will effetively handle cases were no work was done due to invalid refspecs or insufficient permissions. Fixes #271 --- git/remote.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'git/remote.py') diff --git a/git/remote.py b/git/remote.py index 6a15c9c4..4baa2838 100644 --- a/git/remote.py +++ b/git/remote.py @@ -568,7 +568,12 @@ class Remote(LazyMixin, Iterable): # end # We are only interested in stderr here ... - finalize_process(proc) + try: + finalize_process(proc) + except Exception: + if len(fetch_info_lines) == 0: + raise + # end exception handler # read head information fp = open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb') @@ -601,7 +606,11 @@ class Remote(LazyMixin, Iterable): # END exception handling # END for each line - handle_process_output(proc, stdout_handler, progress_handler, finalize_process) + try: + handle_process_output(proc, stdout_handler, progress_handler, finalize_process) + except Exception: + if len(output) == 0: + raise return output def fetch(self, refspec=None, progress=None, **kwargs): -- cgit v1.2.1