0

Having trouble figuring out how to update an entry which is multiple levels deep. My example below is trying to update the file at test/hist/out, but it also deletes all other files from test/hist/.

The TreeBuilder constructor doesnt accept TreeEntries, only Trees, so I'm not sure how to go about it. Any idea?

_o = repo.TreeBuilder()
_o.insert('out', blob_id, pygit2.GIT_FILEMODE_BLOB)
_o = _o.write()

_h = repo.TreeBuilder()
_h.insert('hist', _o, pygit2.GIT_FILEMODE_TREE)
_h = _h.write()

_t = repo.TreeBuilder(tree)
_t.insert('test', _h, pygit2.GIT_FILEMODE_TREE)
_t = _t.write()
Scott
  • 4,070
  • 3
  • 21
  • 16

1 Answers1

0

Figured it out, the answer is to pass tree['path/to/your/subfolder'].oid in the construction of your TreeBuilders. Yay!

Scott
  • 4,070
  • 3
  • 21
  • 16
  • Could you elaborate on that with a working example? I'm having the exact same issue, but this doesn't really help – Dave Vogt Jul 23 '16 at 14:12