/* Count how many entries there are.. */
desc.buf = item->buffer;
desc.size = item->size;
- while (desc.size) {
+ while (tree_entry(&desc, &entry))
n_refs++;
- update_tree_entry(&desc);
- }
/* Allocate object refs and walk it again.. */
i = 0;
int parse_tree(struct tree *item)
{
- char type[20];
+ enum object_type type;
void *buffer;
unsigned long size;
if (item->object.parsed)
return 0;
- buffer = read_sha1_file(item->object.sha1, type, &size);
+ buffer = read_sha1_file(item->object.sha1, &type, &size);
if (!buffer)
return error("Could not read %s",
sha1_to_hex(item->object.sha1));
- if (strcmp(type, tree_type)) {
+ if (type != OBJ_TREE) {
free(buffer);
return error("Object %s not a tree",
sha1_to_hex(item->object.sha1));