summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-20 16:13:28 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-20 16:13:28 -0800
commitc484166374218c4af063c5b646af2a6e8fd7845e (patch)
tree355fccbdad12da1366a0be78a79cd59d849c289e /sha1_file.c
parent428ae2eff0f7b68f8bbb1fd462aca5112614427d (diff)
parent18bc76164dbf4f6d54b8fa9c9c29db9ca66c7877 (diff)
downloadgit-c484166374218c4af063c5b646af2a6e8fd7845e.tar.gz
Merge branch 'jk/empty-tree'
* jk/empty-tree: add--interactive: handle initial commit better hard-code the empty tree object
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index d9da7c8f75..1ddb96bb82 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1845,6 +1845,15 @@ static struct cached_object {
} *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;
@@ -1854,6 +1863,8 @@ static struct cached_object *find_cached_object(const unsigned char *sha1)
if (!hashcmp(co->sha1, sha1))
return co;
}
+ if (!hashcmp(sha1, empty_tree.sha1))
+ return &empty_tree;
return NULL;
}