summaryrefslogtreecommitdiff
path: root/tree.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 /tree.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 'tree.c')
-rw-r--r--tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index 79b9625..23476da 100644
--- a/tree.c
+++ b/tree.c
@@ -77,6 +77,7 @@ struct tree *lookup_tree(unsigned char *sha1)
struct tree *ret = malloc(sizeof(struct tree));
memset(ret, 0, sizeof(struct tree));
created_object(sha1, &ret->object);
+ ret->object.type = tree_type;
return ret;
}
if (obj->parsed && obj->type != tree_type) {
@@ -96,7 +97,6 @@ int parse_tree(struct tree *item)
if (item->object.parsed)
return 0;
item->object.parsed = 1;
- item->object.type = tree_type;
buffer = bufptr = read_sha1_file(item->object.sha1, type, &size);
if (!buffer)
return error("Could not read %s",