зеркало из https://github.com/microsoft/git.git
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: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
2740b2b853
Коммит
d93b7d1c30
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче