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);
+ if (commit->parents) {
+ free_commit_list(commit->parents);
+ commit->parents = NULL;
+ }
+ if (commit->buffer) {
+ free(commit->buffer);
+ commit->buffer = NULL;
+ }
}
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);
}
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)
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;
}
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;
}