summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c47d0e)
raw | patch | inline | side by side (parent: 6c47d0e)
author | Jeff King <peff@peff.net> | |
Wed, 13 Feb 2008 11:25:04 +0000 (06:25 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 13 Feb 2008 21:44:17 +0000 (13:44 -0800) |
Now any commands may reference the empty tree object by its
sha1 (4b825dc642cb6eb9a060e54bf8d69288fbee4904). This is
useful for showing some diffs, especially for initial
commits.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1 (4b825dc642cb6eb9a060e54bf8d69288fbee4904). This is
useful for showing some diffs, especially for initial
commits.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 66a4e00fa83fd9fc853a1ba8a308b05cdc030967..f7b75b2acc1f52775d70f94fa20c0ca98b8f58c9 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
} *cached_objects;
static int cached_object_nr, cached_object_alloc;
+static struct cached_object empty_tree = {
+ /* empty tree sha1: 4b825dc642cb6eb9a060e54bf8d69288fbee4904 */
+ "\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60"
+ "\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04",
+ OBJ_TREE,
+ "",
+ 0
+};
+
static struct cached_object *find_cached_object(const unsigned char *sha1)
{
int i;
if (!hashcmp(co->sha1, sha1))
return co;
}
+ if (!hashcmp(sha1, empty_tree.sha1))
+ return &empty_tree;
return NULL;
}