diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-04-08 11:00:32 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-04-08 11:00:32 +0200 |
commit | e9f8f159ebad405b2c08aa75f735146bb8e216ef (patch) | |
tree | fd09cabbbeb15291b26f5a7775c126ed2cbcabc7 /git/remote.py | |
parent | 723f100a422577235e06dc024a73285710770fca (diff) | |
download | gitpython-e9f8f159ebad405b2c08aa75f735146bb8e216ef.tar.gz |
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
Diffstat (limited to 'git/remote.py')
-rw-r--r-- | git/remote.py | 13 |
1 files changed, 11 insertions, 2 deletions
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): |