The type doesn't come from the parsing, the type also has to match the usage.
ret->object.type = commit_type;
return ret;
}
ret->object.type = commit_type;
return ret;
}
- if (obj->parsed && obj->type != commit_type) {
+ if (obj->type != commit_type) {
error("Object %s is a %s, not a commit",
sha1_to_hex(sha1), obj->type);
return NULL;
error("Object %s is a %s, not a commit",
sha1_to_hex(sha1), obj->type);
return NULL;
ret->object.type = tree_type;
return ret;
}
ret->object.type = tree_type;
return ret;
}
- if (obj->parsed && obj->type != tree_type) {
+ if (obj->type != tree_type) {
error("Object %s is a %s, not a tree",
sha1_to_hex(sha1), obj->type);
return NULL;
error("Object %s is a %s, not a tree",
sha1_to_hex(sha1), obj->type);
return NULL;