6 # The default, auto_abbrev will treat -e as an abbreviation of --end
7 # Which isn't what we want.
8 use Getopt::Long qw(:config pass_through no_auto_abbrev);
11 unshift @ARGV, '--help' unless GetOptions('start=s' => \$start,
15 $runner =~ s/bisect\.pl/bisect-runner.pl/;
17 die "Can't find bisect runner $runner" unless -f $runner;
19 system $^X, $runner, '--check-args', @ARGV and exit 255;
21 # We try these in this order for the start revision if none is specified.
22 my @stable = qw(perl-5.002 perl-5.003 perl-5.004 perl-5.005 perl-5.6.0
23 perl-5.8.0 v5.10.0 v5.12.0 v5.14.0);
26 system "git rev-parse $start >/dev/null" and die;
28 $end = 'blead' unless defined $end;
29 system "git rev-parse $end >/dev/null" and die;
31 my $modified = () = `git ls-files --modified --deleted --others`;
33 die "This checkout is not clean - $modified modified or untracked file(s)"
36 system "git bisect reset" and die;
38 # Sanity check the first and last revisions:
40 system "git checkout $start" and die;
41 my $ret = system $^X, $runner, @ARGV;
42 die "Runner returned $ret, not 0 for start revision" if $ret;
44 # Try to find the earliest version for which the test works
45 foreach my $try (@stable) {
46 system "git checkout $try" and die;
47 my $ret = system $^X, $runner, @ARGV;
53 die "Can't find a suitable start revision to default to. Tried @stable"
54 unless defined $start;
56 system "git checkout $end" and die;
57 my $ret = system $^X, $runner, @ARGV;
58 die "Runner returned $ret for end revision" unless $ret;
60 system "git bisect start" and die;
61 system "git bisect good $start" and die;
62 system "git bisect bad $end" and die;
64 # And now get git bisect to do the hard work:
65 system 'git', 'bisect', 'run', $^X, $runner, @ARGV and die;
70 printf "That took %d seconds\n", $end_time - $start_time
71 if defined $start_time;
75 # cperl-indent-level: 4
76 # indent-tabs-mode: nil
79 # ex: set ts=8 sts=4 sw=4 et: