commit:     f5d258656de3db54af06fbca9b8da5217d3802f4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 22 21:11:35 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 21:45:10 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5d25865

GitSync.update: handle git rev-list failure (bug 594822)

Fixes: 84413bb1dd9d ("GitSync.update: respect sync-depth (bug 552814)")
X-Gentoo-bug: 594822
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=594822

 pym/portage/sync/modules/git/git.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/pym/portage/sync/modules/git/git.py 
b/pym/portage/sync/modules/git/git.py
index c1028ab..3734b80 100644
--- a/pym/portage/sync/modules/git/git.py
+++ b/pym/portage/sync/modules/git/git.py
@@ -90,10 +90,16 @@ class GitSync(NewBase):
                        # Since the default merge strategy typically fails when
                        # the depth is not unlimited, use `git fetch` followed 
by
                        # `git reset --merge`.
-                       remote_branch = portage._unicode_decode(
-                               subprocess.check_output([self.bin_command, 
'rev-parse',
-                               '--abbrev-ref', '--symbolic-full-name', 
'@{upstream}'],
-                               
cwd=portage._unicode_encode(self.repo.location))).rstrip('\n')
+                       try:
+                               remote_branch = portage._unicode_decode(
+                                       
subprocess.check_output([self.bin_command, 'rev-parse',
+                                       '--abbrev-ref', '--symbolic-full-name', 
'@{upstream}'],
+                                       
cwd=portage._unicode_encode(self.repo.location))).rstrip('\n')
+                       except subprocess.CalledProcessError as e:
+                               msg = "!!! git rev-parse error in %s" % 
self.repo.location
+                               self.logger(self.xterm_titles, msg)
+                               writemsg_level(msg + "\n", level=logging.ERROR, 
noiselevel=-1)
+                               return (e.returncode, False)
 
                        git_cmd_opts += " --depth %d" % self.repo.sync_depth
                        git_cmd = "%s fetch %s%s" % (self.bin_command,

Reply via email to