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...).
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) = @_;
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;