From 0aebf0161570b7948cd049f554d76084bf901e09 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 11 Apr 2024 18:58:26 +0000 Subject: lei blob: fix attachment extraction for unimported||inflight Noticed while trying to make other reliability improvements to lei... --- lib/PublicInbox/LeiBlob.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/LeiBlob.pm b/lib/PublicInbox/LeiBlob.pm index 127cc81e..00697097 100644 --- a/lib/PublicInbox/LeiBlob.pm +++ b/lib/PublicInbox/LeiBlob.pm @@ -119,14 +119,17 @@ sub lei_blob { } else { open $rdr->{2}, '>', '/dev/null' or die "open: $!"; } - my $cmd = [ 'git', '--git-dir='.$lei->ale->git->{git_dir}, - 'cat-file', 'blob', $blob ]; + my $cmd = $lei->ale->git->cmd('cat-file', 'blob', $blob); + my $cerr; if (defined $lei->{-attach_idx}) { my $buf = run_qx($cmd, $lei->{env}, $rdr); return extract_attach($lei, $blob, \$buf) unless $?; + $cerr = $?; + } else { + $rdr->{1} = $lei->{1}; # write directly to client + $cerr = run_wait($cmd, $lei->{env}, $rdr) or return; } - $rdr->{1} = $lei->{1}; - my $cerr = run_wait($cmd, $lei->{env}, $rdr) or return; + # fall back to unimported ('lei index') and inflight blobs my $lms = $lei->lms; my $bref = ($lms ? $lms->local_blob($blob, 1) : undef) // do { my $sto = $lei->{sto} // $lei->_lei_store; -- cgit v1.2.3-24-ge0c7