summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2011-06-13 15:57:42 +0200
committerSebastian Thiel <byronimo@gmail.com>2011-06-13 15:57:42 +0200
commit59587d81412ca9da1fd06427efd864174d76c1c5 (patch)
tree2a02ddc3ea62bd7b51ca2b518533fc00653657dc
parent48fab54afab49f18c260463a79b90d594c7a5833 (diff)
downloadgitpython-59587d81412ca9da1fd06427efd864174d76c1c5.tar.gz
Made remote line parsing more stable. On windows it can be that we encounter partial or intermixed lines from the pipe. This really shouldn't be, but its windows so it happens
-rw-r--r--.gitmodules6
-rw-r--r--git/remote.py4
-rw-r--r--git/util.py13
3 files changed, 17 insertions, 6 deletions
diff --git a/.gitmodules b/.gitmodules
index 5741d992..c1e1e76d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
-[submodule "gitdb"]
- path = git/ext/gitdb
- url = git://github.com/gitpython-developers/gitdb.git
+[submodule "gitdb"]
+ path = git/ext/gitdb
+ url = git://github.com/gitpython-developers/gitdb.git
diff --git a/git/remote.py b/git/remote.py
index 0920a7c4..a3b91113 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -49,7 +49,7 @@ def digest_process_messages(fh, progress):
if not char:
break
- if char in ('\r', '\n'):
+ if char in ('\r', '\n') and line_so_far:
dropped_lines.extend(progress._parse_progress_line(line_so_far))
line_so_far = ''
else:
@@ -510,7 +510,7 @@ class Remote(LazyMixin, Iterable):
fetch_head_info = fp.readlines()
fp.close()
- assert len(fetch_info_lines) == len(fetch_head_info)
+ assert len(fetch_info_lines) == 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))
diff --git a/git/util.py b/git/util.py
index 71bf6977..6576640a 100644
--- a/git/util.py
+++ b/git/util.py
@@ -176,7 +176,18 @@ class RemoteProgress(object):
elif op_name == 'Resolving deltas':
op_code |= self.RESOLVING
else:
- raise ValueError("Operation name %r unknown" % op_name)
+ # Note: On windows it can happen that partial lines are sent
+ # Hence we get something like "CompreReceiving objects", which is
+ # a blend of "Compressing objects" and "Receiving objects".
+ # This can't really be prevented, so we drop the line verbosely
+ # to make sure we get informed in case the process spits out new
+ # commands at some point.
+ self.line_dropped(sline)
+ sys.stderr.write("Operation name %r unknown - skipping line '%s'" % (op_name, sline))
+ # Note: Don't add this line to the failed lines, as we have to silently
+ # drop it
+ return failed_lines
+ # END handle op code
# figure out stage
if op_code not in self._seen_ops: