# HG changeset patch
# User Connor Sheehan <sheehan@mozilla.com>
# Date 2020-09-22 13:06:09
# Node ID 73a5aa5e1857d320b863180b686229333632fd36
# Parent  89f0d9f87701cb953dfa48b8deb456fa7a97e1a8

git: pass `id` attribute of `pygit2.Tree` object

`pygit2`'s Repository object expects an instance of `Oid`
to return the corresponding object, instead of the object
itself.

After this change and D9062, `hg commit -i` seems to work,
unless it hits a case folding assertion (ie trying to add
a file like `README.md`).

Differential Revision: https://phab.mercurial-scm.org/D9068

diff --git a/hgext/git/manifest.py b/hgext/git/manifest.py
--- a/hgext/git/manifest.py
+++ b/hgext/git/manifest.py
@@ -322,7 +322,8 @@ class memgittreemanifestctx(object):
             for part in comps:
                 parent = trees[full]
                 try:
-                    new = self._repo[parent[pycompat.fsdecode(part)]]
+                    parent_tree_id = parent[pycompat.fsdecode(part)].id
+                    new = self._repo[parent_tree_id]
                 except KeyError:
                     # new directory
                     new = None