tree: convert read_tree_1 to use struct object_id internally