Patchwork D8541: git: avoid looking-up parents for the null commit

login
register
mail settings
Submitter phabricator
Date May 17, 2020, 5:41 p.m.
Message ID <differential-rev-PHID-DREV-rdqd57zaap6aijako3ry-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46329/
State Superseded
Headers show

Comments

phabricator - May 17, 2020, 5:41 p.m.
rom1dep created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8541

AFFECTED FILES
  hgext/git/gitlog.py

CHANGE DETAILS




To: rom1dep, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -324,7 +324,10 @@ 
     def parentrevs(self, rev):
         n = self.node(rev)
         hn = gitutil.togitnode(n)
-        c = self.gitrepo[hn]
+        if hn != gitutil.nullgit:
+            c = self.gitrepo[hn]
+        else:
+            return nodemod.nullrev, nodemod.nullrev
         p1 = p2 = nodemod.nullrev
         if c.parents:
             p1 = self.rev(c.parents[0].id.raw)