aboutsummaryrefslogtreecommitdiff
path: root/rev-list.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-02 09:25:44 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-02 09:25:44 -0700
commit3b42a63cb5845ef1c818f6b00e693c61469ee966 (patch)
tree1482fd25e51da7133271eedb25c7a87fa8be7466 /rev-list.c
parent81f2bb1f54b20abefa9d102ea98c4ac73d81a66d (diff)
downloadgit-3b42a63cb5845ef1c818f6b00e693c61469ee966.tar.gz
git-3b42a63cb5845ef1c818f6b00e693c61469ee966.tar.xz
git-rev-list: split out commit limiting from main() too.
Ok, now I'm happier.
Diffstat (limited to 'rev-list.c')
-rw-r--r--rev-list.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/rev-list.c b/rev-list.c
index 8775b6558..56dd814c0 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -84,6 +84,25 @@ static int everybody_uninteresting(struct commit_list *list)
return 1;
}
+struct commit_list *limit_list(struct commit_list *list, struct commit *end)
+{
+ struct commit_list *newlist = NULL;
+ struct commit_list **p = &newlist;
+ do {
+ struct commit *commit = pop_most_recent_commit(&list, SEEN);
+ struct object *obj = &commit->object;
+
+ if (commit == end || (obj->flags & UNINTERESTING)) {
+ mark_parents_uninteresting(commit);
+ if (everybody_uninteresting(list))
+ break;
+ continue;
+ }
+ p = &commit_list_insert(commit, p)->next;
+ } while (list);
+ return newlist;
+}
+
int main(int argc, char **argv)
{
int nr_sha;
@@ -144,23 +163,8 @@ int main(int argc, char **argv)
}
commit_list_insert(commit, &list);
- if (end) {
- struct commit_list *newlist = NULL;
- struct commit_list **p = &newlist;
- do {
- struct commit *commit = pop_most_recent_commit(&list, SEEN);
- struct object *obj = &commit->object;
-
- if (commit == end || (obj->flags & UNINTERESTING)) {
- mark_parents_uninteresting(commit);
- if (everybody_uninteresting(list))
- break;
- continue;
- }
- p = &commit_list_insert(commit, p)->next;
- } while (list);
- list = newlist;
- }
+ if (end)
+ list = limit_list(list, end);
show_commit_list(list);
return 0;