Convert a tree entry to the git_object it points too.
repository where to lookup the pointed object
a tree entry
0 on success; error code otherwise