提交 d93b7d1c 编写于 作者: J Jeff King 提交者: Junio C Hamano

get_tree_entry: map blank requested entry to tree root

This means that
  git show HEAD:
will now return HEAD^{tree}, which is logically consistent with
  git show HEAD:Documentation
Signed-off-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 2740b2b8
......@@ -199,10 +199,17 @@ int get_tree_entry(const unsigned char *tree_sha1, const char *name, unsigned ch
int retval;
void *tree;
struct tree_desc t;
unsigned char root[20];
tree = read_object_with_reference(tree_sha1, tree_type, &t.size, NULL);
tree = read_object_with_reference(tree_sha1, tree_type, &t.size, root);
if (!tree)
return -1;
if (name[0] == '\0') {
hashcpy(sha1, root);
return 0;
}
t.buf = tree;
retval = find_tree_entry(&t, name, sha1, mode);
free(tree);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册