summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-05-25 16:48:31 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-05-25 16:48:31 +0200
commitb0be02e1471c99e5e5e4bd52db1019006d26c349 (patch)
tree1563c5ceb94cc1a7303014098d7274c810c6c256
parentbed46300fe5dcb376d43da56bbcd448d73bb2ea0 (diff)
downloadgitpython-b0be02e1471c99e5e5e4bd52db1019006d26c349.tar.gz
fix(remote): remove assertion in favour of runtime stability
Fixes #442
-rw-r--r--git/remote.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/git/remote.py b/git/remote.py
index e430abf5..54773a6f 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -20,8 +20,6 @@ from .refs import (
SymbolicReference,
TagReference
)
-
-
from git.util import (
LazyMixin,
Iterable,
@@ -35,6 +33,9 @@ from git.util import (
from git.cmd import handle_process_output
from gitdb.util import join
from git.compat import defenc
+import logging
+
+log = logging.getLogger('git.remote')
__all__ = ('RemoteProgress', 'PushInfo', 'FetchInfo', 'Remote')
@@ -570,10 +571,16 @@ class Remote(LazyMixin, Iterable):
fetch_head_info = [l.decode(defenc) for l in fp.readlines()]
fp.close()
- # NOTE: We assume to fetch at least enough progress lines to allow matching each fetch head line with it.
l_fil = len(fetch_info_lines)
l_fhi = len(fetch_head_info)
- assert l_fil >= l_fhi, "len(%s) <= len(%s)" % (l_fil, l_fhi)
+ if l_fil >= l_fhi:
+ msg = "Fetch head does not contain enough lines to match with progress information\n"
+ msg += "length of progress lines %i should be equal to lines in FETCH_HEAD file %i\n"
+ msg += "Will ignore extra progress lines."
+ msg %= (l_fil, l_fhi)
+ log.warn(msg)
+ fetch_info_lines = fetch_info_lines[:l_fhi]
+ # end sanity check + sanitization
output.extend(FetchInfo._from_line(self.repo, err_line, fetch_line)
for err_line, fetch_line in zip(fetch_info_lines, fetch_head_info))