Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 25 lines (20 sloc) 577 Bytes
#!/usr/bin/env perl
use strict;
use warnings;
my ($pattern, $grabnext);
for (@ARGV) {
if ($grabnext or not /^-/) {
$pattern = $_;
last;
} elsif (/^--$/) {
$grabnext = 1;
}
}
# Accept a --no-S or --no-smart-case flag to disable our smarts
my @args = grep { not /^--no-(S|smart-?case)$/ } @ARGV;
my $do_smart_case = @ARGV == @args;
# Prepend -i to match case-insensitively when the pattern contains no uppercase
unshift @args, "-i"
if $pattern eq lc $pattern and $do_smart_case;
exec "git", "grep", @args
or die "exec failed: $!";