This can also be written as `git_tree_lookup`, which avoids some casting.