# HG changeset patch # User Mads Kiilerich # Date 1411561480 -7200 # Node ID 8cf1d694bda05ad355b3927560388fe1f0ab6c22 # Parent 2f18ebfead0cd4bb2589d2fc734487eb14a499f6 vcs: introduce hack for handling git failure on --depth cloning (Issue #33) diff -r 2f18ebfead0c -r 8cf1d694bda0 kallithea/lib/vcs/subprocessio.py --- a/kallithea/lib/vcs/subprocessio.py Wed Sep 24 14:24:40 2014 +0200 +++ b/kallithea/lib/vcs/subprocessio.py Wed Sep 24 14:24:40 2014 +0200 @@ -375,14 +375,20 @@ except Exception: pass bg_out.stop() + out = ''.join(bg_out) bg_err.stop() - err = '%s' % ''.join(bg_err) - if err: + err = ''.join(bg_err) + if (err.strip() == 'fatal: The remote end hung up unexpectedly' and + out.startswith('0034shallow ')): + # hack inspired by https://github.com/schacon/grack/pull/7 + bg_out = iter([out]) + _p = None + elif err: raise EnvironmentError( "Subprocess exited due to an error:\n" + err) - raise EnvironmentError( - "Subprocess exited with non 0 ret code:%s" % _returncode) - + else: + raise EnvironmentError( + "Subprocess exited with non 0 ret code:%s" % _returncode) self.process = _p self.output = bg_out self.error = bg_err @@ -392,7 +398,7 @@ return self def next(self): - if self.process.poll(): + if self.process and self.process.poll(): err = '%s' % ''.join(self.error) raise EnvironmentError("Subprocess exited due to an error:\n" + err) return self.output.next()