diff --git a/git/remote.py b/git/remote.py index f89e9d83c..706d2e2ae 100644 --- a/git/remote.py +++ b/git/remote.py @@ -519,6 +519,7 @@ def _get_fetch_info_from_stderr(self, proc, progress): # this also waits for the command to finish # Skip some progress lines that don't provide relevant information fetch_info_lines = list() + seen_refs = set() for line in digest_process_messages(proc.stderr, progress): if line.startswith('From') or line.startswith('remote: Total') or line.startswith('POST'): continue @@ -529,6 +530,9 @@ def _get_fetch_info_from_stderr(self, proc, progress): raise GitCommandError(("Error when fetching: %s" % line,), 2) # END handle special messages fetch_info_lines.append(line) + ref = re.search(r'\b(\S+)\s+->\s', line) + if ref: + seen_refs.add(ref.group(1)) # END for each line # read head information @@ -536,7 +540,7 @@ def _get_fetch_info_from_stderr(self, proc, progress): fetch_head_info = fp.readlines() fp.close() - assert len(fetch_info_lines) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines) + assert len(seen_refs) == len(fetch_head_info), "len(%s) != len(%s)" % (fetch_head_info, fetch_info_lines) output.extend(FetchInfo._from_line(self.repo, err_line, fetch_line) for err_line,fetch_line in zip(fetch_info_lines, fetch_head_info))