lib/PublicInbox/Feed.pm | 4 ++-- lib/PublicInbox/Git.pm | 2 +- lib/PublicInbox/Import.pm | 4 ++-- lib/PublicInbox/ViewDiff.pm | 4 ++-- lib/PublicInbox/WWW.pm | 2 +- t/edit.t | 4 ++-- t/plack.t | 2 +- t/replace.t | 2 +- t/v2writable.t | 4 ++-- diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index cbdf5db99f8b8486e8a14caff84259c63e560fd9..805076f0e1294cb577108aea449850958922a20e 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -88,7 +88,7 @@ my $qp = $ctx->{qp}; my $hex = '[a-f0-9]'; my $addmsg = qr!^:000000 100644 \S+ (\S+) A\t${hex}{2}/${hex}{38}$!; my $delmsg = qr!^:100644 000000 (\S+) \S+ D\t(${hex}{2}/${hex}{38})$!; - my $refhex = qr/(?:HEAD|${hex}{4,40})(?:~[0-9]+)?/; + my $refhex = qr/(?:HEAD|${hex}{4,})(?:~[0-9]+)?/; # revision ranges may be specified my $range = 'HEAD'; @@ -126,7 +126,7 @@ if ($last) { local $/ = "\n"; while (my $line = <$log>) { - if ($line =~ /^(${hex}{7,40})/) { + if ($line =~ /^(${hex}{7,})/) { $last_commit = $1; last; } diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 181026c7bc1b726ff562e1b488f3256a0bf98c87..a7ba57f94fa2f9d4bfc270fe774ab50679b05286 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -185,7 +185,7 @@ my ($req, $cb, $arg) = splice(@$inflight, 0, 3); my $rbuf = delete($self->{cat_rbuf}) // \(my $new = ''); my ($bref, $oid, $type, $size); my $head = my_readline($self->{in}, $rbuf); - if ($head =~ /^([0-9a-f]{40}) (\S+) ([0-9]+)$/) { + if ($head =~ /^([0-9a-f]{40,}) (\S+) ([0-9]+)$/) { ($oid, $type, $size) = ($1, $2, $3 + 0); $bref = my_read($self->{in}, $rbuf, $size + 1) or fail($self, defined($bref) ? 'read EOF' : "read: $!"); diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index ee5ca2ea11b4f383e514ecdf117ac1dabe2c14c1..1a226cc78dd4e45a429c8f026137251373ff5a8c 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -106,7 +106,7 @@ print $w "cat-blob $oid\n" or wfail; local $/ = "\n"; my $info = <$r>; defined $info or die "EOF from fast-import / cat-blob: $!"; - $info =~ /\A[a-f0-9]{40} blob ([0-9]+)\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 = ''; @@ -137,7 +137,7 @@ sub check_remove_v1 { my ($r, $w, $tip, $path, $mime) = @_; my $info = _check_path($r, $w, $tip, $path) or return ('MISSING',undef); - $info =~ m!\A100644 blob ([a-f0-9]{40})\t!s or die "not blob: $info"; + $info =~ m!\A100644 blob ([a-f0-9]{40,})\t!s or die "not blob: $info"; my $oid = $1; my $msg = _cat_blob($r, $w, $oid) or die "BUG: cat-blob $1 failed"; my $cur = PublicInbox::Eml->new($msg); diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 536bb9e3c99e458e486e96f0abdb2fa9eca83637..7ec57d8d5fddc4f8ccbc2e8cb5b8f7ff4b608d7a 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -18,8 +18,8 @@ use PublicInbox::Git qw(git_unquote); sub UNSAFE () { "^A-Za-z0-9\-\._~/" } -my $OID_NULL = '0{7,40}'; -my $OID_BLOB = '[a-f0-9]{7,40}'; +my $OID_NULL = '0{7,}'; +my $OID_BLOB = '[a-f0-9]{7,}'; my $LF = qr!\n!; my $ANY = qr![^\n]!; my $FN = qr!(?:"?[^/\n]+/[^\n]+|/dev/null)!; diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 85abf327de884140aac246c5407229b135817433..e3b589cb78d4475c39eba9d8ca6c6f8e89e9610d 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -29,7 +29,7 @@ our $INBOX_RE = qr!\A/([\w\-][\w\.\-]*)!; our $MID_RE = qr!([^/]+)!; our $END_RE = qr!(T/|t/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; our $ATTACH_RE = qr!([0-9][0-9\.]*)-($PublicInbox::Hval::FN)!; -our $OID_RE = qr![a-f0-9]{7,40}!; +our $OID_RE = qr![a-f0-9]{7,}!; sub new { my ($class, $pi_config) = @_; diff --git a/t/edit.t b/t/edit.t index 4b004c1c2b622f58b5f7b8a2ff3579a59c40a3db..dbdda394d3344549a6fe229a151e3cf42b536432 100644 --- a/t/edit.t +++ b/t/edit.t @@ -41,7 +41,7 @@ $cmd = [ '-edit', "-F$file", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t edit OK"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); like($cur->header('Subject'), qr/bool pfx/, "$t message edited"); - like($out, qr/[a-f0-9]{40}/, "$t shows commit on success"); + like($out, qr/[a-f0-9]{40,}/, "$t shows commit on success"); } $t = '-m MESSAGE_ID'; { @@ -51,7 +51,7 @@ $cmd = [ '-edit', "-m$mid", $inboxdir ]; ok(run_script($cmd, undef, $opt), "$t edit OK"); $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid)); like($cur->header('Subject'), qr/boolean prefix/, "$t message edited"); - like($out, qr/[a-f0-9]{40}/, "$t shows commit on success"); + like($out, qr/[a-f0-9]{40,}/, "$t shows commit on success"); } $t = 'no-op -m MESSAGE_ID'; { diff --git a/t/plack.t b/t/plack.t index 4b830a21e35c72b3bf1712d0150ae73b8483a144..1fedf426dead7a2449b212acc41dbcc4773bb655 100644 --- a/t/plack.t +++ b/t/plack.t @@ -45,7 +45,7 @@ EOF $im->add($mime); $im->done; my $rev = $git->qx(qw(rev-list HEAD)); - like($rev, qr/\A[a-f0-9]{40}/, "good revision committed"); + like($rev, qr/\A[a-f0-9]{40,}/, "good revision committed"); @ls = $git->qx(qw(ls-tree -r --name-only HEAD)); chomp @ls; diff --git a/t/replace.t b/t/replace.t index 95241adf6842282eae8b4ce805d42b79ec8c5c02..fd8ce2c64a0e8b682ae7feb3aa207167a9604556 100644 --- a/t/replace.t +++ b/t/replace.t @@ -74,7 +74,7 @@ my $changed_epochs = 0; for my $tip (@$cmts) { next if !defined $tip; $changed_epochs++; - like($tip, qr/\A[a-f0-9]{40}\z/, + like($tip, qr/\A[a-f0-9]{40,}\z/, 'replace returned current commit'); } is($changed_epochs, 1, 'only one epoch changed'); diff --git a/t/v2writable.t b/t/v2writable.t index 1de8c032da14d199f11efdac601ce57e67984ed8..2f71fafaab60b9c0bcaf2b4bfa1af5ddff7eef92 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -255,8 +255,8 @@ { ok($im->add($mime), 'add message to be purged'); local $SIG{__WARN__} = sub {}; - ok(my $cmts = $im->purge($mime), 'purged message'); - like($cmts->[0], qr/\A[a-f0-9]{40}\z/, 'purge returned current commit'); + ok(my $cmt = $im->purge($mime), 'purged message'); + like($cmt->[0], qr/\A[a-f0-9]{40,}\z/, 'purge returned current commit'); $im->done; # again