From cbd13f06bf17357a9e160a6ae54a3f532e9eb068 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 19 Apr 2023 21:54:48 +0000 Subject: cindex: support sha256 coderepos alongside sha1 This special support is only needed for --prune at the moment since the indexing side works on a per-repo basis. There's no automated tests, yet, but it seems to work well on my sha256 projects when sharing a cindex with sha1 projects. --- lib/PublicInbox/Git.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Git.pm') diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index 3108ed85..61ba8aa1 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -22,7 +22,9 @@ use IO::Poll qw(POLLIN); use Carp qw(croak carp); use PublicInbox::SHA (); use PublicInbox::DS qw(awaitpid); -our @EXPORT_OK = qw(git_unquote git_quote); +our %HEXLEN2SHA = (40 => 1, 64 => 256); +our %OFMT2HEXLEN = (sha1 => 40, sha256 => 64); +our @EXPORT_OK = qw(git_unquote git_quote %HEXLEN2SHA %OFMT2HEXLEN); our $PIPE_BUFSIZ = 65536; # Linux default our $in_cleanup; our $RDTIMEO = 60_000; # milliseconds -- cgit v1.2.3-24-ge0c7