This is one way to enable implementing 'TreeBuilder.get'. It also makes pygit2 a little lower-level. And makes TreeEntry consistent with IndexEntry, which lacks such a function.