1. Arne Babenhauserheide
  2. hg-git


Gregory Szorc  committed 5a688ad

Verify tree and parent objects are in Git repo

When exporting Git commits, verify that the tree and parents objects
exist in the repository before allowing the commit to be exported. If a
tree or parent commit is missing, then the repository is not valid and
the export should not be allowed.

  • Participants
  • Parent commits c9faba7
  • Branches default

Comments (0)

Files changed (1)

File hggit/git_handler.py

View file
             hgsha = hex(parent.node())
             git_sha = self.map_git_get(hgsha)
             if git_sha:
+                if git_sha not in self.git.object_store:
+                    raise hgutil.Abort(_('Parent SHA-1 not present in Git'
+                                         'repo: %s' % git_sha))
         commit.message = self.get_git_message(ctx)
             commit.encoding = extra['encoding']
         tree_sha = commit_tree(self.git.object_store, self.iterblobs(ctx))
+        if tree_sha not in self.git.object_store:
+            raise hgutil.Abort(_('Tree SHA-1 not present in Git repo: %s' %
+                tree_sha))
         commit.tree = tree_sha