X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=builtin-rev-list.c;h=e885624255ac8e1007df797d339e3e81020f95a2;hp=446802d37758c0aa5b2ff3ec917b49316d303312;hb=7612a1efdb0c0806b43db10ce784707aae874340;hpb=9463ed0d737d498be5cbb6672428a8a1fbaf9120 diff --git a/builtin-rev-list.c b/builtin-rev-list.c index 446802d3..e8856242 100644 --- a/builtin-rev-list.c +++ b/builtin-rev-list.c @@ -85,7 +85,7 @@ static void show_commit(struct commit *commit) static char pretty_header[16384]; pretty_print_commit(revs.commit_format, commit, ~0, pretty_header, sizeof(pretty_header), - revs.abbrev); + revs.abbrev, NULL, NULL); printf("%s%c", pretty_header, hdr_termination); } fflush(stdout); @@ -103,6 +103,7 @@ static struct object_list **process_blob(struct blob *blob, if (obj->flags & (UNINTERESTING | SEEN)) return p; obj->flags |= SEEN; + name = strdup(name); return add_object(obj, p, path, name); } @@ -112,7 +113,8 @@ static struct object_list **process_tree(struct tree *tree, const char *name) { struct object *obj = &tree->object; - struct tree_entry_list *entry; + struct tree_desc desc; + struct name_entry entry; struct name_path me; if (!revs.tree_objects) @@ -122,21 +124,23 @@ static struct object_list **process_tree(struct tree *tree, if (parse_tree(tree) < 0) die("bad tree object %s", sha1_to_hex(obj->sha1)); obj->flags |= SEEN; + name = strdup(name); p = add_object(obj, p, path, name); me.up = path; me.elem = name; me.elem_len = strlen(name); - entry = tree->entries; - tree->entries = NULL; - while (entry) { - struct tree_entry_list *next = entry->next; - if (entry->directory) - p = process_tree(entry->item.tree, p, &me, entry->name); + + desc.buf = tree->buffer; + desc.size = tree->size; + + while (tree_entry(&desc, &entry)) { + if (S_ISDIR(entry.mode)) + p = process_tree(lookup_tree(entry.sha1), p, &me, entry.path); else - p = process_blob(entry->item.blob, p, &me, entry->name); - free(entry); - entry = next; + p = process_blob(lookup_blob(entry.sha1), p, &me, entry.path); } + free(tree->buffer); + tree->buffer = NULL; return p; }