Skip to content

Commit 5077fc7

Browse files
committed
Return all the stderr messge after an error is detected for pull()
1 parent e836e5c commit 5077fc7

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

‎git/cmd.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def __del__(self):
307307
def__getattr__(self, attr):
308308
returngetattr(self.proc, attr)
309309

310-
defwait(self, stderr=None):
310+
defwait(self, stderr=''):
311311
"""Wait for the process and return its status code.
312312
313313
:param stderr: Previously read value of stderr, in case stderr is already closed.
@@ -317,7 +317,7 @@ def wait(self, stderr=None):
317317

318318
defread_all_from_possibly_closed_stream(stream):
319319
try:
320-
returnstream.read()
320+
returnstderr+stream.read()
321321
exceptValueError:
322322
returnstderror''
323323

@@ -678,7 +678,7 @@ def _kill_process(pid):
678678
# strip trailing "\n"
679679
ifstderr_value.endswith(b"\n"):
680680
stderr_value=stderr_value[:-1]
681-
status=proc.wait()
681+
status=proc.wait(stderr=stderr_value)
682682
# END stdout handling
683683
finally:
684684
proc.stdout.close()

‎git/remote.py‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,21 +570,36 @@ def _get_fetch_info_from_stderr(self, proc, progress):
570570

571571
progress_handler=progress.new_message_handler()
572572

573+
error_message=None
574+
stderr_text=None
575+
573576
forlineinproc.stderr:
574577
line=force_text(line)
575578
forplineinprogress_handler(line):
576579
ifline.startswith('fatal:') orline.startswith('error:'):
577-
raiseGitCommandError(("Error when fetching: %s"%line,), 2)
580+
error_message="Error when fetching: %s"% (line,)
581+
break
582+
578583
# END handle special messages
579584
forcmdincmds:
580585
iflen(line) >1andline[0] ==' 'andline[1] ==cmd:
581586
fetch_info_lines.append(line)
582587
continue
583588
# end find command code
584589
# end for each comand code we know
590+
591+
iferror_messageisnotNone:
592+
break
585593
# end for each line progress didn't handle
594+
595+
iferror_messageisnotNone:
596+
stderr_text=proc.stderr.read()
597+
586598
# end
587-
finalize_process(proc)
599+
finalize_process(proc, stderr=stderr_text)
600+
601+
iferror_messageisnotNone:
602+
raiseGitCommandError( error_message, 2, stderr=stderr_text )
588603

589604
# read head information
590605
fp=open(join(self.repo.git_dir, 'FETCH_HEAD'), 'rb')

0 commit comments

Comments
(0)