about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-15 19:51:37 +0000
committerEric Wong <e@80x24.org>2020-09-16 04:06:10 +0000
commit82d793d96cc37d5b3cf562c7081bfacb05d1e4cd (patch)
treea66af407cfa46641a77f60631cef50a8c487bbb4 /lib
parent9cdeab04ebd95c7f778ba5f258399377b180f2cc (diff)
downloadpublic-inbox-82d793d96cc37d5b3cf562c7081bfacb05d1e4cd.tar.gz
treewide: relax allow >=40 chars for git OID
This will help with eventual git SHA-256 transitions.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Feed.pm4
-rw-r--r--lib/PublicInbox/Git.pm2
-rw-r--r--lib/PublicInbox/Import.pm4
-rw-r--r--lib/PublicInbox/ViewDiff.pm4
-rw-r--r--lib/PublicInbox/WWW.pm2
5 files changed, 8 insertions, 8 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index cbdf5db9..805076f0 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -88,7 +88,7 @@ sub recent_msgs {
         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 @@ sub recent_msgs {
         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 181026c7..a7ba57f9 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -185,7 +185,7 @@ sub cat_async_step ($$) {
         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 ee5ca2ea..1a226cc7 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -106,7 +106,7 @@ sub _cat_blob ($$$) {
         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 536bb9e3..7ec57d8d 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 85abf327..e3b589cb 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) = @_;