While I don't expect git to suddenly start spewing non-ASCII
digits in places I'd expect ASCII, this would make things easier
for future hackers and reviewers.
- $head =~ /^[0-9a-f]{40} \S+ (\d+)$/ or
+ $head =~ /^[0-9a-f]{40} \S+ ([0-9]+)$/ or
fail($self, "Unexpected result from git cat-file: $head");
my $size = $1;
fail($self, "Unexpected result from git cat-file: $head");
my $size = $1;
foreach my $oid (<$fh>) {
chomp $oid;
my $buf = cat_file($self, $oid) or next;
foreach my $oid (<$fh>) {
chomp $oid;
my $buf = cat_file($self, $oid) or next;
- $$buf =~ /^committer .*?> (\d+) [\+\-]?\d+/sm or next;
+ $$buf =~ /^committer .*?> ([0-9]+) [\+\-]?[0-9]+/sm or next;
my $cmt_time = $1;
$modified = $cmt_time if $cmt_time > $modified;
}
my $cmt_time = $1;
$modified = $cmt_time if $cmt_time > $modified;
}
local $/ = "\n";
my $info = <$r>;
defined $info or die "EOF from fast-import / cat-blob: $!";
local $/ = "\n";
my $info = <$r>;
defined $info or die "EOF from fast-import / cat-blob: $!";
- $info =~ /\A[a-f0-9]{40} blob (\d+)\n\z/ or return;
+ $info =~ /\A[a-f0-9]{40} blob ([0-9]+)\n\z/ or return;
my $left = $1;
my $offset = 0;
my $buf = '';
my $left = $1;
my $offset = 0;
my $buf = '';
foreach my $i (0..$#$buf) {
my $l = $buf->[$i];
foreach my $i (0..$#$buf) {
my $l = $buf->[$i];
- if ($l =~ /^author .* (\d+ [\+-]?\d+)$/) {
+ if ($l =~ /^author .* ([0-9]+ [\+-]?[0-9]+)$/) {
$buf->[$i] = "author <> $1\n";
$buf->[$i] = "author <> $1\n";
- } elsif ($l =~ /^data (\d+)/) {
+ } elsif ($l =~ /^data ([0-9]+)/) {
$buf->[$i++] = "data " . length($cmt_msg) . "\n";
$buf->[$i] = $cmt_msg;
last;
$buf->[$i++] = "data " . length($cmt_msg) . "\n";
$buf->[$i] = $cmt_msg;
last;
@buf = ();
}
push @buf, "commit $tmp\n";
@buf = ();
}
push @buf, "commit $tmp\n";
- } elsif (/^data (\d+)/) {
+ } elsif (/^data ([0-9]+)/) {
# only commit message, so $len is small:
my $len = $1; # + 1 for trailing "\n"
push @buf, $_;
# only commit message, so $len is small:
my $len = $1; # + 1 for trailing "\n"
push @buf, $_;
@buf = ();
} elsif ($_ eq "done\n") {
$done = 1;
@buf = ();
} elsif ($_ eq "done\n") {
$done = 1;
- } elsif (/^mark :(\d+)$/) {
+ } elsif (/^mark :([0-9]+)$/) {
push @buf, $_;
$mark = $1;
} else {
push @buf, $_;
$mark = $1;
} else {
$state = 'blob';
} elsif (/^commit /) {
$state = 'commit';
$state = 'blob';
} elsif (/^commit /) {
$state = 'commit';
- } elsif (/^data (\d+)/) {
+ } elsif (/^data ([0-9]+)/) {
my $len = $1;
$w->print($_) or $im->wfail;
while ($len) {
my $len = $1;
$w->print($_) or $im->wfail;
while ($len) {
}
next;
} elsif ($state eq 'commit') {
}
next;
} elsif ($state eq 'commit') {
- if (m{^M 100644 :(\d+) (${h}{2}/${h}{38})}o) {
+ if (m{^M 100644 :([0-9]+) (${h}{2}/${h}{38})}o) {
my ($mark, $path) = ($1, $2);
$D{$path} = $mark;
if ($last && $last ne 'm') {
my ($mark, $path) = ($1, $2);
$D{$path} = $mark;
if ($last && $last ne 'm') {
+ if (m{^from (:[0-9]+)}) {
$prev = $from;
$from = $1;
# no next
$prev = $from;
$from = $1;
# no next