git: avoid looking-up parents for the null commit
authorRomain DEP. <rom1dep@gmail.com>
Mon, 11 May 2020 21:56:11 +0200
changeset 44844 8bfc6cc8e480
parent 44843 288328c6711b
child 44845 3e09d22a0bf5
git: avoid looking-up parents for the null commit Differential Revision: https://phab.mercurial-scm.org/D8541
hgext/git/gitlog.py
--- a/hgext/git/gitlog.py	Mon May 11 21:56:43 2020 +0200
+++ b/hgext/git/gitlog.py	Mon May 11 21:56:11 2020 +0200
@@ -270,7 +270,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)