Merge branch 'jc/diff-format-doc'
[gitweb.git] / list-objects.c
index 206816fa9c47eb419775bcf2005f9cd5144bc297..2a139b6ced68809f3a324f493325ec62c3a44044 100644 (file)
@@ -81,8 +81,11 @@ static void process_tree(struct rev_info *revs,
                die("bad tree object");
        if (obj->flags & (UNINTERESTING | SEEN))
                return;
-       if (parse_tree(tree) < 0)
+       if (parse_tree(tree) < 0) {
+               if (revs->ignore_missing_links)
+                       return;
                die("bad tree object %s", sha1_to_hex(obj->sha1));
+       }
        obj->flags |= SEEN;
        show(obj, path, name, cb_data);
        me.up = path;
@@ -154,7 +157,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
 
                if (commit->object.flags & UNINTERESTING) {
                        mark_tree_uninteresting(commit->tree);
-                       if (revs->edge_hint && !(commit->object.flags & SHOWN)) {
+                       if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) {
                                commit->object.flags |= SHOWN;
                                show_edge(commit);
                        }
@@ -162,7 +165,7 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
                }
                mark_edge_parents_uninteresting(commit, revs, show_edge);
        }
-       if (revs->edge_hint) {
+       if (revs->edge_hint_aggressive) {
                for (i = 0; i < revs->cmdline.nr; i++) {
                        struct object *obj = revs->cmdline.rev[i].item;
                        struct commit *commit = (struct commit *)obj;
@@ -205,6 +208,7 @@ void traverse_commit_list(struct rev_info *revs,
                struct object_array_entry *pending = revs->pending.objects + i;
                struct object *obj = pending->item;
                const char *name = pending->name;
+               const char *path = pending->path;
                if (obj->flags & (UNINTERESTING | SEEN))
                        continue;
                if (obj->type == OBJ_TAG) {
@@ -212,24 +216,21 @@ void traverse_commit_list(struct rev_info *revs,
                        show_object(obj, NULL, name, data);
                        continue;
                }
+               if (!path)
+                       path = "";
                if (obj->type == OBJ_TREE) {
                        process_tree(revs, (struct tree *)obj, show_object,
-                                    NULL, &base, name, data);
+                                    NULL, &base, path, data);
                        continue;
                }
                if (obj->type == OBJ_BLOB) {
                        process_blob(revs, (struct blob *)obj, show_object,
-                                    NULL, name, data);
+                                    NULL, path, data);
                        continue;
                }
                die("unknown pending object %s (%s)",
                    sha1_to_hex(obj->sha1), name);
        }
-       if (revs->pending.nr) {
-               free(revs->pending.objects);
-               revs->pending.nr = 0;
-               revs->pending.alloc = 0;
-               revs->pending.objects = NULL;
-       }
+       object_array_clear(&revs->pending);
        strbuf_release(&base);
 }