bisect: move common bisect functionality to "bisect_common"
So we can easily reuse the code in a later patch. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Apr 19, 2009 at 11:55 UTC
2ace9727be2b04ce9fbc5939466da38be7fd8496
1 file changed
+15
-9
bisect.c
+15
-9
@@ -532,6 +532,20 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix)
532
revs->limited = 1;
533
}
534
535
+static void bisect_common(struct rev_info *revs, const char *prefix,
536
+ int *reaches, int *all)
537
+{
538
+ bisect_rev_setup(revs, prefix);
539
+
540
+ if (prepare_revision_walk(revs))
541
+ die("revision walk setup failed");
542
+ if (revs->tree_objects)
543
+ mark_edges_uninteresting(revs->commits, revs, NULL);
544
+
545
+ revs->commits = find_bisection(revs->commits, reaches, all,
546
+ !!skipped_sha1_nr);
547
+}
548
+
549
int bisect_next_vars(const char *prefix)
550
{
551
struct rev_info revs;
@@ -542,15 +556,7 @@ int bisect_next_vars(const char *prefix)
556
info.revs = &revs;
557
info.bisect_show_flags = BISECT_SHOW_TRIED | BISECT_SHOW_STRINGED;
558
545
- bisect_rev_setup(&revs, prefix);
546
-
547
- if (prepare_revision_walk(&revs))
548
- die("revision walk setup failed");
549
- if (revs.tree_objects)
550
- mark_edges_uninteresting(revs.commits, &revs, NULL);
551
-
552
- revs.commits = find_bisection(revs.commits, &reaches, &all,
553
- !!skipped_sha1_nr);
559
+ bisect_common(&revs, prefix, &reaches, &all);
560
561
return show_bisect_vars(&info, reaches, all);
562
}