diff options
author | Eric Wong <e@80x24.org> | 2021-04-29 09:46:17 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-04-30 06:41:36 +0000 |
commit | 64886302aea5b329a1ec0227d209c14b4a5dda96 (patch) | |
tree | f48e4df808d810ce5dfae9a41fc0b808fd022a7c /lib/PublicInbox | |
parent | 08b649735a94af6a5385df3b78092e5818408df1 (diff) | |
download | public-inbox-64886302aea5b329a1ec0227d209c14b4a5dda96.tar.gz |
This will be convenient to avoid the overhead of PublicInbox::Eml for verifying synchronization in lei.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/ContentHash.pm | 6 | ||||
-rw-r--r-- | lib/PublicInbox/LeiViewText.pm | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/PublicInbox/ContentHash.pm b/lib/PublicInbox/ContentHash.pm index 112b1ea6..cc4a54c9 100644 --- a/lib/PublicInbox/ContentHash.pm +++ b/lib/PublicInbox/ContentHash.pm @@ -97,9 +97,9 @@ sub content_hash ($) { sub git_sha ($$) { my ($n, $eml) = @_; my $dig = Digest::SHA->new($n); - my $buf = $eml->as_string; - $dig->add('blob '.length($buf)."\0"); - $dig->add($buf); + my $bref = ref($eml) eq 'SCALAR' ? $eml : \($eml->as_string); + $dig->add('blob '.length($$bref)."\0"); + $dig->add($$bref); $dig; } diff --git a/lib/PublicInbox/LeiViewText.pm b/lib/PublicInbox/LeiViewText.pm index d0f8b7f4..340a6648 100644 --- a/lib/PublicInbox/LeiViewText.pm +++ b/lib/PublicInbox/LeiViewText.pm @@ -7,7 +7,6 @@ package PublicInbox::LeiViewText; use strict; use v5.10.1; use PublicInbox::MsgIter qw(msg_part_text); -use PublicInbox::ContentHash qw(git_sha); use PublicInbox::MID qw(references); use PublicInbox::View; use PublicInbox::Hval; |