diff options
author | Eric Wong <e@80x24.org> | 2024-05-09 00:39:01 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-05-09 03:08:01 +0000 |
commit | 39c390da4f5793bdd08a3634ca34ed9c9bda0700 (patch) | |
tree | 75d879b15388519020222eeff485a479469513ac /lib/PublicInbox/RepoSnapshot.pm | |
parent | cf3df165033bf36631bd890fa2375339cd95c593 (diff) | |
download | public-inbox-master.tar.gz |
Repeatedly checking $PATH for `git' when we need to call it multiple times in quick succession doesn't seem useful. So avoid some expensive stat(2) syscalls to make things less bad for systems which require expensive CPU vulnerability mitigations. This also saves a bunch of memory allocations since we do the $PATH lookup in pure Perl to avoid doing the uncacheable lookup in a vfork-ed child.
Diffstat (limited to 'lib/PublicInbox/RepoSnapshot.pm')
-rw-r--r-- | lib/PublicInbox/RepoSnapshot.pm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/PublicInbox/RepoSnapshot.pm b/lib/PublicInbox/RepoSnapshot.pm index 4c372569..bff97bc8 100644 --- a/lib/PublicInbox/RepoSnapshot.pm +++ b/lib/PublicInbox/RepoSnapshot.pm @@ -50,15 +50,13 @@ sub ver_check { # git->check_async callback delete($ctx->{env}->{'qspawn.wcb'})->(r(404)); } else { # found, done: $ctx->{etag} = $oid; - my @cfg; + my $cmd = $ctx->{git}->cmd; if (my $cmd = $FMT_CFG{$ctx->{snap_fmt}}) { - @cfg = ('-c', "tar.$ctx->{snap_fmt}.command=$cmd"); + push @$cmd, '-c', "tar.$ctx->{snap_fmt}.command=$cmd"; } - my $qsp = PublicInbox::Qspawn->new(['git', @cfg, - "--git-dir=$ctx->{git}->{git_dir}", 'archive', - "--prefix=$ctx->{snap_pfx}/", - "--format=$ctx->{snap_fmt}", $treeish], undef, - { quiet => 1 }); + push @$cmd, 'archive', "--prefix=$ctx->{snap_pfx}/", + "--format=$ctx->{snap_fmt}", $treeish; + my $qsp = PublicInbox::Qspawn->new($cmd, undef, { quiet => 1 }); $qsp->psgi_yield($ctx->{env}, undef, \&archive_hdr, $ctx); } } |