summaryrefslogtreecommitdiffstats
path: root/commit.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-04-22 02:41:40 +0200
committerJunio C Hamano <junkio@cox.net>2007-04-22 02:42:02 +0200
commit42c4b58059fa9af65e90f2c418bb551e30d1d32f (patch)
treec6aa1b75909009b249ceb768717c27011b73adb4 /commit.c
parentMerge branch 'jc/add' (diff)
parentClean up object creation to use more common code (diff)
downloadgit-42c4b58059fa9af65e90f2c418bb551e30d1d32f.tar.xz
git-42c4b58059fa9af65e90f2c418bb551e30d1d32f.zip
Merge branch 'lt/objalloc'
* 'lt/objalloc': Clean up object creation to use more common code Use proper object allocators for unknown object nodes too
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/commit.c b/commit.c
index 952095faa7..10466c4ae0 100644
--- a/commit.c
+++ b/commit.c
@@ -98,12 +98,8 @@ struct commit *lookup_commit_reference(const unsigned char *sha1)
struct commit *lookup_commit(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
- if (!obj) {
- struct commit *ret = alloc_commit_node();
- created_object(sha1, &ret->object);
- ret->object.type = OBJ_COMMIT;
- return ret;
- }
+ if (!obj)
+ return create_object(sha1, OBJ_COMMIT, alloc_commit_node());
if (!obj->type)
obj->type = OBJ_COMMIT;
return check_commit(obj, sha1, 0);