summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/commit.c b/commit.c
index 4ff8077dbf..eb24add866 100644
--- a/commit.c
+++ b/commit.c
@@ -61,10 +61,8 @@ struct commit *lookup_commit_or_die(const unsigned char *sha1, const char *ref_n
struct commit *lookup_commit(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
- if (!obj) {
- struct commit *c = alloc_commit_node();
- return create_object(sha1, OBJ_COMMIT, c);
- }
+ if (!obj)
+ return create_object(sha1, alloc_commit_node());
if (!obj->type)
obj->type = OBJ_COMMIT;
return check_commit(obj, sha1, 0);