summaryrefslogtreecommitdiff
path: root/list-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-09-06 01:42:23 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-07 02:46:02 -0700
commit8d1d8f83b5d918c6071b606e321de9c31fed9e68 (patch)
treeff7f6754f7f4b5a1c3722bbae94f613d00121610 /list-objects.c
parentb5d97e6b0a044b11b409250189c61d40209065f2 (diff)
downloadgit-8d1d8f83b5d918c6071b606e321de9c31fed9e68.tar.gz
pack-objects: further work on internal rev-list logic.
This teaches the internal rev-list logic to understand options that are needed for pack handling: --all, --unpacked, and --thin. It also moves two functions from builtin-rev-list to list-objects so that the two programs can share more code. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'list-objects.c')
-rw-r--r--list-objects.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/list-objects.c b/list-objects.c
index adaf9979e6..f1fa21c397 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -66,6 +66,39 @@ static void process_tree(struct rev_info *revs,
tree->buffer = NULL;
}
+static void mark_edge_parents_uninteresting(struct commit *commit,
+ struct rev_info *revs,
+ show_edge_fn show_edge)
+{
+ struct commit_list *parents;
+
+ for (parents = commit->parents; parents; parents = parents->next) {
+ struct commit *parent = parents->item;
+ if (!(parent->object.flags & UNINTERESTING))
+ continue;
+ mark_tree_uninteresting(parent->tree);
+ if (revs->edge_hint && !(parent->object.flags & SHOWN)) {
+ parent->object.flags |= SHOWN;
+ show_edge(parent);
+ }
+ }
+}
+
+void mark_edges_uninteresting(struct commit_list *list,
+ struct rev_info *revs,
+ show_edge_fn show_edge)
+{
+ for ( ; list; list = list->next) {
+ struct commit *commit = list->item;
+
+ if (commit->object.flags & UNINTERESTING) {
+ mark_tree_uninteresting(commit->tree);
+ continue;
+ }
+ mark_edge_parents_uninteresting(commit, revs, show_edge);
+ }
+}
+
void traverse_commit_list(struct rev_info *revs,
void (*show_commit)(struct commit *),
void (*show_object)(struct object_array_entry *))