Set object type at object creation time, not object parse time.

Otherwise we can have objects without a type, which is not good.
This commit is contained in:
Linus Torvalds
2005-04-24 14:17:13 -07:00
parent 4728b861ac
commit d32987be61
2 changed files with 2 additions and 2 deletions

2
tree.c
View File

@ -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",