Fixed regular expression, open arg, and git options; basically working script now.

This commit is contained in:
Bradley M. Kuhn 2010-06-26 13:45:07 -04:00
parent a87ea6f4a8
commit 7acc424f94

View file

@ -30,20 +30,21 @@ if (@ARGV != 1) {
}
my($GIT_CMD) = @ARGV;
$GIT_CMD .= " --no-color";
$GIT_CMD .= " --date=rfc" unless $GIT_CMD =~ /--date/;
open(GIT_OUTPUT, "|-", $GIT_CMD) or die "unable to run \"$GIT_CMD\": $!";
open(GIT_OUTPUT, "-|", $GIT_CMD) or die "unable to run \"$GIT_CMD\": $!";
my $currentCommit = "";
my $skipThisOne = 1;
while (my $line = <GIT_OUTPUT>) {
if ($line =~ /^\s*commit\s+/) {
if ($line =~ /^\s*commit\s+/i) {
print $currentCommit unless $skipThisOne;
$skipThisOne = 0;
$currentCommit = "";
} elsif ($line = /^\s*Date:\s*(\S+)\,/) { #Warning: assumes --date=rfc
} elsif ($line =~ /^\s*Date\s*:\s*(\S+)\s*,/i) { #Warning: assumes --date=rfc
my $day = $1;
$skipThisOne = ($day !~ /(Sat|Sun)/);
$skipThisOne = ($day !~ /(Sat|Sun)/i);
}
$currentCommit .= $line;
}