Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
get_tree_entry: map blank requested entry to tree root
author
Jeff King
<peff@peff.net>
Tue, 9 Jan 2007 16:11:47 +0000
(11:11 -0500)
committer
Junio C Hamano
<junkio@cox.net>
Tue, 9 Jan 2007 22:08:41 +0000
(14:08 -0800)
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>
tree-walk.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
2740b2b
)
diff --git
a/tree-walk.c
b/tree-walk.c
index 22f4550b6ca4d2cb185fc19f6be414a8a0874a60..70f899957e8ce511f0f5a470e8b6927d58d1b63e 100644
(file)
--- a/
tree-walk.c
+++ b/
tree-walk.c
@@
-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);