X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=builtin-rev-list.c;h=2b298c4e412c4fca24ea5068f17a557f89a6a449;hb=d3ff6f55012c939740ce0982b24aeb6fba3c6e4f;hp=f11dbd65c14a196f92c98d5c16be0cda74a1edf1;hpb=a861b58bbf4bced62a0b8faa8deba107edb0bffd;p=git.git diff --git a/builtin-rev-list.c b/builtin-rev-list.c index f11dbd65..2b298c4e 100644 --- a/builtin-rev-list.c +++ b/builtin-rev-list.c @@ -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; } @@ -154,16 +158,16 @@ static void show_commit_list(struct rev_info *revs) const char *name = pending->name; if (obj->flags & (UNINTERESTING | SEEN)) continue; - if (obj->type == tag_type) { + if (obj->type == TYPE_TAG) { obj->flags |= SEEN; p = add_object(obj, p, NULL, name); continue; } - if (obj->type == tree_type) { + if (obj->type == TYPE_TREE) { p = process_tree((struct tree *)obj, p, NULL, name); continue; } - if (obj->type == blob_type) { + if (obj->type == TYPE_BLOB) { p = process_blob((struct blob *)obj, p, NULL, name); continue; }