summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-24 21:17:13 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-24 21:17:13 (GMT)
commitd32987be618181db1f435a5c0a1bea85e90c7c7d (patch)
tree000a0382e736b024de1581ca3781b561a2ab1942 /commit.c
parent4728b861ace127dc39c648f3bea64c3b86bbabc5 (diff)
downloadgit-d32987be618181db1f435a5c0a1bea85e90c7c7d.zip
git-d32987be618181db1f435a5c0a1bea85e90c7c7d.tar.gz
git-d32987be618181db1f435a5c0a1bea85e90c7c7d.tar.bz2
Set object type at object creation time, not object parse time.
Otherwise we can have objects without a type, which is not good.
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/commit.c b/commit.c
index 2502688..c0dd689 100644
--- a/commit.c
+++ b/commit.c
@@ -12,6 +12,7 @@ struct commit *lookup_commit(unsigned char *sha1)
struct commit *ret = malloc(sizeof(struct commit));
memset(ret, 0, sizeof(struct commit));
created_object(sha1, &ret->object);
+ ret->object.type = commit_type;
return ret;
}
if (obj->parsed && obj->type != commit_type) {
@@ -56,7 +57,6 @@ int parse_commit(struct commit *item)
if (strcmp(type, commit_type))
return error("Object %s not a commit",
sha1_to_hex(item->object.sha1));
- item->object.type = commit_type;
get_sha1_hex(bufptr + 5, parent);
item->tree = lookup_tree(parent);
add_ref(&item->object, &item->tree->object);