diff options
author | Eric Wong <e@80x24.org> | 2023-10-25 06:33:55 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-25 07:28:51 +0000 |
commit | 9d8a15fdb93e3a32f73169f827953c69c5ff251e (patch) | |
tree | 8f9374fe75f1cfee78a01670c6d3bd70010fc44f /lib/PublicInbox/Fetch.pm | |
parent | a309ca6ba5f3c0a541bb15414a4c3357a86dfbda (diff) | |
download | public-inbox-9d8a15fdb93e3a32f73169f827953c69c5ff251e.tar.gz |
While uncommon, some git repos have hundreds of thousands of refs and slurping that output into memory can bloat the heap. Introduce a sha_all sub in PublicInbox::SHA to loop until EOF and rely on autodie for checking sysread errors.
Diffstat (limited to 'lib/PublicInbox/Fetch.pm')
-rw-r--r-- | lib/PublicInbox/Fetch.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Fetch.pm b/lib/PublicInbox/Fetch.pm index 6e9b1e94..e41dd448 100644 --- a/lib/PublicInbox/Fetch.pm +++ b/lib/PublicInbox/Fetch.pm @@ -10,6 +10,7 @@ use PublicInbox::Admin; use PublicInbox::LEI; use PublicInbox::LeiCurl; use PublicInbox::LeiMirror; +use PublicInbox::SHA qw(sha_all); use File::Temp (); sub new { bless {}, __PACKAGE__ } @@ -92,9 +93,8 @@ sub do_manifest ($$$) { sub get_fingerprint2 { my ($git_dir) = @_; - require PublicInbox::SHA; my $rd = popen_rd([qw(git show-ref)], undef, { -C => $git_dir }); - PublicInbox::SHA::sha256(do { local $/; <$rd> }); + sha_all(256, $rd)->digest; # ignore show-ref errors } sub writable_dir ($) { |