I think the type could be checked on the tree entry before calling `git_tree_entry_to_object` and save object lookup and creation when the type match is wrong. Then I think you can get rid of the `tmpobj` variable and pass the caller's `out` value on through.