summaryrefslogtreecommitdiff
path: root/Porting
diff options
context:
space:
mode:
Diffstat (limited to 'Porting')
-rwxr-xr-xPorting/bisect-runner.pl53
1 files changed, 43 insertions, 10 deletions
diff --git a/Porting/bisect-runner.pl b/Porting/bisect-runner.pl
index 92c6852d31..6f7409cc4d 100755
--- a/Porting/bisect-runner.pl
+++ b/Porting/bisect-runner.pl
@@ -90,7 +90,8 @@ pod2usage(exitval => 255, verbose => 1)
pod2usage(exitval => 255, verbose => 1)
if !$options{'one-liner'} && ($options{l} || $options{w});
-check_shebang($ARGV[0]) if $options{'check-shebang'} && @ARGV;
+check_shebang($ARGV[0])
+ if $options{'check-shebang'} && @ARGV && !$options{match};
exit 0 if $options{'check-args'};
@@ -351,12 +352,35 @@ I<number of CPUs>. Otherwise defaults to 2.
Instead of running a test program to determine I<pass> or I<fail>, pass
if the given regex matches, and hence search for the commit that removes
-the last matching file.
+the last matching file. C<--expect-fail> can be used with C<--match> to
+search for a commit that adds files that match.
+
+The remaining command line arguments are treated as glob patterns for files
+to match against. If none are specified, then they default as follows:
+
+=over 4
+
+=item *
If no I<target> is specified, the match is against all files in the
-repository (which is fast). If a I<target> is specified, that target is
-built, and the match is against only the built files. C<--expect-fail> can
-be used with C<--match> to search for a commit that adds files that match.
+repository (which is fast).
+
+=item *
+
+If a I<target> is specified, that target is built, and the match is against
+only the built files.
+
+=back
+
+Treating the command line arguments as glob patterns should not cause
+problems, as the perl distribution has never shipped or built files with
+names that contain characters which are globbing metacharacters.
+
+Anything which is not a readable file is ignored, instead of generating an
+error. (If you want an error, run C<grep> or C<ack> as a test case). This
+permits one to easily search in a file that changed its name. For example:
+
+ .../Porting/bisect.pl --match 'Pod.*Functions' 'pod/buildtoc*'
=item *
@@ -774,12 +798,21 @@ sub report_and_exit {
}
sub match_and_exit {
- my $target = shift;
+ my ($target, @globs) = @_;
my $matches = 0;
my $re = qr/$match/;
my @files;
- {
+ if (@globs) {
+ require File::Glob;
+ foreach (sort map { File::Glob::bsd_glob($_)} @globs) {
+ if (!-f $_ || !-r _) {
+ warn "Skipping matching '$_' as it is not a readable file\n";
+ } else {
+ push @files, $_;
+ }
+ }
+ } else {
local $/ = "\0";
@files = defined $target ? `git ls-files -o -z`: `git ls-files -z`;
chomp @files;
@@ -809,7 +842,7 @@ sub match_and_exit {
system 'git clean -dxf </dev/null' and die;
if (!defined $target) {
- match_and_exit() if $match;
+ match_and_exit(undef, @ARGV) if $match;
$target = 'test_prep';
}
@@ -914,7 +947,7 @@ if (-f 'config.sh') {
}
if ($target =~ /config\.s?h/) {
- match_and_exit($target) if $match && -f $target;
+ match_and_exit($target, @ARGV) if $match && -f $target;
report_and_exit(!-f $target, 'could build', 'could not build', $target)
if $options{'test-build'};
@@ -997,7 +1030,7 @@ if ($options{'test-build'}) {
skip("could not build $real_target");
}
-match_and_exit($real_target) if $match;
+match_and_exit($real_target, @ARGV) if $match;
if (defined $options{'one-liner'}) {
my $exe = $target =~ /^(?:perl$|test)/ ? 'perl' : 'miniperl';