summaryrefslogtreecommitdiff
path: root/builtin-rev-list.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-09-06 08:42:23 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-09-07 09:46:02 (GMT)
commit8d1d8f83b5d918c6071b606e321de9c31fed9e68 (patch)
treeff7f6754f7f4b5a1c3722bbae94f613d00121610 /builtin-rev-list.c
parentb5d97e6b0a044b11b409250189c61d40209065f2 (diff)
downloadgit-8d1d8f83b5d918c6071b606e321de9c31fed9e68.zip
git-8d1d8f83b5d918c6071b606e321de9c31fed9e68.tar.gz
git-8d1d8f83b5d918c6071b606e321de9c31fed9e68.tar.bz2
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 'builtin-rev-list.c')
-rw-r--r--builtin-rev-list.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 0900737..1f3333d 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -114,6 +114,11 @@ static void show_object(struct object_array_entry *p)
printf("%s %s\n", sha1_to_hex(p->item->sha1), p->name);
}
+static void show_edge(struct commit *commit)
+{
+ printf("-%s\n", sha1_to_hex(commit->object.sha1));
+}
+
/*
* This is a truly stupid algorithm, but it's only
* used for bisection, and we just don't care enough.
@@ -192,35 +197,6 @@ static struct commit_list *find_bisection(struct commit_list *list)
return best;
}
-static void mark_edge_parents_uninteresting(struct commit *commit)
-{
- 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;
- printf("-%s\n", sha1_to_hex(parent->object.sha1));
- }
- }
-}
-
-static void mark_edges_uninteresting(struct commit_list *list)
-{
- 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);
- }
-}
-
static void read_revisions_from_stdin(struct rev_info *revs)
{
char line[1000];
@@ -300,7 +276,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
prepare_revision_walk(&revs);
if (revs.tree_objects)
- mark_edges_uninteresting(revs.commits);
+ mark_edges_uninteresting(revs.commits, &revs, show_edge);
if (bisect_list)
revs.commits = find_bisection(revs.commits);