about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-04-20 10:23:02 +0000
committerEric Wong <e@80x24.org>2023-04-20 18:22:58 +0000
commitc0af4b7e17b265c3c7d6d9c148488f49b18ea485 (patch)
treefc6c9c86f006037cc59c8b9c34ce90db6fd189c8
parent33d445aac9460af5cbca72887b3153007cf036ff (diff)
downloadpublic-inbox-c0af4b7e17b265c3c7d6d9c148488f49b18ea485.tar.gz
I'm not sure how combining SHA-1 and SHA-256 in a single git
repo will work, eventually.   But this is an obvious place to do
the right thing if we ever see a 64-byte hex string (unless git
adds support for another hash which uses 64-byte hex string
representations, which would break many assumptions elsewhere,
too...).
-rw-r--r--lib/PublicInbox/LeiMailSync.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiMailSync.pm b/lib/PublicInbox/LeiMailSync.pm
index ea4d48c1..308b1695 100644
--- a/lib/PublicInbox/LeiMailSync.pm
+++ b/lib/PublicInbox/LeiMailSync.pm
@@ -9,6 +9,7 @@ use parent qw(PublicInbox::Lock);
 use DBI qw(:sql_types); # SQL_BLOB
 use PublicInbox::ContentHash qw(git_sha);
 use Carp ();
+use PublicInbox::Git qw(%HEXLEN2SHA);
 
 sub dbh_new {
         my ($self) = @_;
@@ -457,7 +458,8 @@ WHERE b.oidbin = ?
                         local $/;
                         my $raw = <$fh>;
                         if ($vrfy) {
-                                my $got = git_sha(1, \$raw)->hexdigest;
+                                my $sha = $HEXLEN2SHA{length($oidhex)};
+                                my $got = git_sha($sha, \$raw)->hexdigest;
                                 if ($got ne $oidhex) {
                                         warn "$f changed $oidhex => $got\n";
                                         next;