summaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/list-objects.c b/list-objects.c
index b2db6ba..2910bec 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -165,15 +165,17 @@ void mark_edges_uninteresting(struct rev_info *revs, show_edge_fn show_edge)
}
mark_edge_parents_uninteresting(commit, revs, show_edge);
}
- for (i = 0; i < revs->cmdline.nr; i++) {
- struct object *obj = revs->cmdline.rev[i].item;
- struct commit *commit = (struct commit *)obj;
- if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
- continue;
- mark_tree_uninteresting(commit->tree);
- if (revs->edge_hint && !(obj->flags & SHOWN)) {
- obj->flags |= SHOWN;
- show_edge(commit);
+ if (revs->edge_hint) {
+ for (i = 0; i < revs->cmdline.nr; i++) {
+ struct object *obj = revs->cmdline.rev[i].item;
+ struct commit *commit = (struct commit *)obj;
+ if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
+ continue;
+ mark_tree_uninteresting(commit->tree);
+ if (!(obj->flags & SHOWN)) {
+ obj->flags |= SHOWN;
+ show_edge(commit);
+ }
}
}
}
@@ -206,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) {
@@ -213,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);
}