@@ -349,6 +349,8 @@ class Remote(LazyMixin, Iterable):
349349    __slots__  =  ("repo" , "name" , "_config_reader" )
350350    _id_attribute_  =  "name" 
351351
352+     _re_find_info  =  re .compile (r'\b(\S+)\s+->\s' )
353+ 
352354    def  __init__ (self , repo , name ):
353355        """Initialize a remote instance 
354356
@@ -513,6 +515,9 @@ def _get_fetch_info_from_stderr(self, proc, progress):
513515        # this also waits for the command to finish 
514516        # Skip some progress lines that don't provide relevant information 
515517        fetch_info_lines  =  list ()
518+         # NOTE: We only keep this information for an assertion, which might as well go away. 
519+         # Implementation based on https://github.com/gitpython-developers/GitPython/pull/143 
520+         seen_refs  =  set ()
516521        for  line  in  digest_process_messages (proc .stderr , progress ):
517522            if  line .startswith ('From' ) or  line .startswith ('remote: Total' ) or  line .startswith ('POST' ) \
518523                    or  line .startswith (' =' ):
@@ -523,6 +528,9 @@ def _get_fetch_info_from_stderr(self, proc, progress):
523528            elif  line .startswith ('fatal:' ):
524529                raise  GitCommandError (("Error when fetching: %s"  %  line ,), 2 )
525530            # END handle special messages 
531+             ref  =  self ._re_find_info .search (line )
532+             if  ref :
533+                 seen_refs .add (ref .group (1 ))
526534            fetch_info_lines .append (line )
527535        # END for each line 
528536
@@ -535,6 +543,8 @@ def _get_fetch_info_from_stderr(self, proc, progress):
535543        # I simply couldn't stand it anymore, so here is the quick and dirty fix ... . 
536544        # This project needs a lot of work ! 
537545        # assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines) 
546+         assert  len (seen_refs ) ==  len (fetch_head_info ), "len(%s) != len(%s)"  %  (fetch_head_info , seen_refs )
547+ 
538548
539549        output .extend (FetchInfo ._from_line (self .repo , err_line , fetch_line )
540550                        for  err_line , fetch_line  in  zip (fetch_info_lines , fetch_head_info ))
0 commit comments