From f71892a55cdd71102af9fed43cb18bdcf89cac84 Mon Sep 17 00:00:00 2001 From: migurski Date: Sat, 15 Mar 2014 14:52:16 -0700 Subject: [PATCH 1/2] Partial fix to issue #142 Introduces a new, different error: Traceback (most recent call last): File "test.py", line 188, in test_simple_conflict commit2 = bizarro.repo.save_working_file(*args2) File "/Users/migurski/Sites/tmp/CMS/bizarro/repo.py", line 77, in save_working_file clone.remotes.origin.push(clone.active_branch.name) File "/Users/migurski/Sites/tmp/CMS/venv-cms/lib/python2.7/site-packages/git/repo/base.py", line 551, in active_branch return self.head.reference File "/Users/migurski/Sites/tmp/CMS/venv-cms/lib/python2.7/site-packages/git/refs/symbolic.py", line 244, in _get_reference raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha)) TypeError: HEAD is a detached symbolic reference as it points to '320ac0ab2ed85f0e65ad734e2a72863a526db5be' --- git/remote.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/git/remote.py b/git/remote.py index f89e9d83c..c7e4eca91 100644 --- a/git/remote.py +++ b/git/remote.py @@ -519,8 +519,9 @@ 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'): + if line.startswith('From') or line.startswith('remote: Total'): continue elif line.startswith('warning:'): print >> sys.stderr, line @@ -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)) From 33898cd410e7a2a46d0c90beafcc376588560b71 Mon Sep 17 00:00:00 2001 From: migurski Date: Sat, 15 Mar 2014 14:55:00 -0700 Subject: [PATCH 2/2] Missed an edit from upstream --- git/remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/remote.py b/git/remote.py index c7e4eca91..706d2e2ae 100644 --- a/git/remote.py +++ b/git/remote.py @@ -521,7 +521,7 @@ def _get_fetch_info_from_stderr(self, proc, progress): 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'): + if line.startswith('From') or line.startswith('remote: Total') or line.startswith('POST'): continue elif line.startswith('warning:'): print >> sys.stderr, line