Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc8c696b

Browse files
committed
fix(remote): don't close stdout on fetch/pull
Reverted changes of `fe2fbc5~2`.This caused `git-pull` to error, which now actually results in a fatalerror while fetching or pulling. Previously we simply didn't checkfor this issue.Now we are back to a `poll` based or threaded concurrent reading fromstdout and stderr to prevent a git process deadlock, and theaforementioned error.Related togitpython-developers#297
1 parent22d2e4a commitc8c696b

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

‎git/remote.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ def update(self, **kwargs):
538538

539539
def_get_fetch_info_from_stderr(self,proc,progress):
540540
# skip first line as it is some remote info we are not interested in
541-
# TODO: Use poll() to process stdout and stderr at same time
542541
output=IterableList('name')
543542

544543
# lines which are no progress are fetch info lines
@@ -551,9 +550,7 @@ def _get_fetch_info_from_stderr(self, proc, progress):
551550

552551
progress_handler=progress.new_message_handler()
553552

554-
forlineinproc.stderr:
555-
line=line.decode(defenc)
556-
line=line.rstrip()
553+
defmy_progress_handler(line):
557554
forplineinprogress_handler(line):
558555
ifline.startswith('fatal:')orline.startswith('error:'):
559556
raiseGitCommandError(("Error when fetching: %s"%line,),2)
@@ -568,12 +565,7 @@ def _get_fetch_info_from_stderr(self, proc, progress):
568565
# end
569566

570567
# We are only interested in stderr here ...
571-
try:
572-
finalize_process(proc)
573-
exceptException:
574-
iflen(fetch_info_lines)==0:
575-
raise
576-
# end exception handler
568+
handle_process_output(proc,None,my_progress_handler,finalize_process)
577569

578570
# read head information
579571
fp=open(join(self.repo.git_dir,'FETCH_HEAD'),'rb')
@@ -593,7 +585,6 @@ def _get_push_info(self, proc, progress):
593585
# we hope stdout can hold all the data, it should ...
594586
# read the lines manually as it will use carriage returns between the messages
595587
# to override the previous one. This is why we read the bytes manually
596-
# TODO: poll() on file descriptors to know what to read next, process streams concurrently
597588
progress_handler=progress.new_message_handler()
598589
output=IterableList('name')
599590

@@ -647,7 +638,6 @@ def fetch(self, refspec=None, progress=None, **kwargs):
647638
args= [refspec]
648639

649640
proc=self.repo.git.fetch(self,*args,with_extended_output=True,as_process=True,v=True,**kwargs)
650-
proc.stdout.close()
651641
res=self._get_fetch_info_from_stderr(proc,progressorRemoteProgress())
652642
ifhasattr(self.repo.odb,'update_cache'):
653643
self.repo.odb.update_cache()
@@ -663,7 +653,6 @@ def pull(self, refspec=None, progress=None, **kwargs):
663653
:return: Please see 'fetch' method """
664654
kwargs=add_progress(kwargs,self.repo.git,progress)
665655
proc=self.repo.git.pull(self,refspec,with_extended_output=True,as_process=True,v=True,**kwargs)
666-
proc.stdout.close()
667656
res=self._get_fetch_info_from_stderr(proc,progressorRemoteProgress())
668657
ifhasattr(self.repo.odb,'update_cache'):
669658
self.repo.odb.update_cache()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp