From b0be02e1471c99e5e5e4bd52db1019006d26c349 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 25 May 2016 16:48:31 +0200 Subject: fix(remote): remove assertion in favour of runtime stability Fixes #442 --- git/remote.py | 15 +++++++++++---- 1 file 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)) -- cgit v1.2.1