@@ -346,7 +346,7 @@ class Remote(LazyMixin, Iterable):
346346 NOTE: When querying configuration, the configuration accessor will be cached
347347 to speed up subsequent accesses."""
348348
349- __slots__ = ("repo" ,"name" ,"_config_reader" )
349+ __slots__ = ("repo" ,"name" ,"_config_reader" , "fetch_no" )
350350_id_attribute_ = "name"
351351
352352def __init__ (self ,repo ,name ):
@@ -356,6 +356,7 @@ def __init__(self, repo, name):
356356 :param name: the name of the remote, i.e. 'origin'"""
357357self .repo = repo
358358self .name = name
359+ self .fetch_no = 0
359360
360361if os .name == 'nt' :
361362# some oddity: on windows, python 2.5, it for some reason does not realize
@@ -551,6 +552,9 @@ def _get_fetch_info_from_stderr(self, proc, progress):
551552progress_handler = progress .new_message_handler ()
552553
553554def my_progress_handler (line ):
555+ stderr_fetch = open (join (self .repo .git_dir ,'%03i_debug_git-python_stderr' % self .fetch_no ),'ab' )
556+ stderr_fetch .write ((line + '\n ' ).encode (defenc ))
557+ stderr_fetch .close ()
554558for pline in progress_handler (line ):
555559if line .startswith ('fatal:' )or line .startswith ('error:' ):
556560raise GitCommandError (("Error when fetching: %s" % line ,),2 )
@@ -567,6 +571,11 @@ def my_progress_handler(line):
567571# We are only interested in stderr here ...
568572handle_process_output (proc ,None ,my_progress_handler ,finalize_process )
569573
574+ import shutil
575+ shutil .copyfile (join (self .repo .git_dir ,'FETCH_HEAD' ),join (self .repo .git_dir ,
576+ '%03i_debug_git-python_FETCH_HEAD' % self .fetch_no ))
577+ self .fetch_no += 1
578+
570579# read head information
571580fp = open (join (self .repo .git_dir ,'FETCH_HEAD' ),'rb' )
572581fetch_head_info = [l .decode (defenc )for l in fp .readlines ()]