- for (entries = tree->entries; entries; entries = entries->next) {
- if (process(entries->item.any->sha1,
- entries->directory ? tree_type : blob_type))
- return -1;
+ desc.buf = tree->buffer;
+ desc.size = tree->size;
+ while (tree_entry(&desc, &entry)) {
+ if (S_ISDIR(entry.mode)) {
+ struct tree *tree = lookup_tree(entry.sha1);
+ process_tree(tree);
+ } else {
+ struct blob *blob = lookup_blob(entry.sha1);
+ process(&blob->object);
+ }