diff --git a/git/remote.py b/git/remote.py index 2cf5678b6..d459d12ce 100644 --- a/git/remote.py +++ b/git/remote.py @@ -794,15 +794,7 @@ def stdout_handler(line: str) -> None: handle_process_output(proc, stdout_handler, progress_handler, finalizer=None, decode_streams=False, kill_after_timeout=kill_after_timeout) stderr_text = progress.error_lines and '\n'.join(progress.error_lines) or '' - try: - proc.wait(stderr=stderr_text) - except Exception: - # This is different than fetch (which fails if there is any std_err - # even if there is an output) - if not output: - raise - elif stderr_text: - log.warning("Error lines received while fetching: %s", stderr_text) + proc.wait(stderr=stderr_text) return output diff --git a/test/test_remote.py b/test/test_remote.py index 088fdad55..ad82d8fba 100644 --- a/test/test_remote.py +++ b/test/test_remote.py @@ -330,10 +330,8 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo): # rejected - undo last commit lhead.reset("HEAD~1") - res = remote.push(lhead.reference) - self.assertTrue(res[0].flags & PushInfo.ERROR) - self.assertTrue(res[0].flags & PushInfo.REJECTED) - self._do_test_push_result(res, remote) + with self.assertRaises(GitCommandError): + remote.push(lhead.reference) # force rejected pull res = remote.push('+%s' % lhead.reference) @@ -357,10 +355,8 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo): # update push new tags # Rejection is default new_tag = TagReference.create(rw_repo, to_be_updated, reference='HEAD~1', force=True) - res = remote.push(tags=True) - self._do_test_push_result(res, remote) - self.assertTrue(res[-1].flags & PushInfo.REJECTED) - self.assertTrue(res[-1].flags & PushInfo.ERROR) + with self.assertRaises(GitCommandError): + remote.push(tags=True) # push force this tag res = remote.push("+%s" % new_tag.path) @@ -386,11 +382,8 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo): # rejected stale delete force_with_lease = "%s:0000000000000000000000000000000000000000" % new_head.path - res = remote.push(":%s" % new_head.path, force_with_lease=force_with_lease) - self.assertTrue(res[0].flags & PushInfo.ERROR) - self.assertTrue(res[0].flags & PushInfo.REJECTED) - self.assertIsNone(res[0].local_ref) - self._do_test_push_result(res, remote) + with self.assertRaises(GitCommandError): + remote.push(":%s" % new_head.path, force_with_lease=force_with_lease) # delete new branch on the remote end and locally res = remote.push(":%s" % new_head.path)