about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-11-28 05:32:11 +0000
committerEric Wong <e@80x24.org>2022-11-28 23:38:58 +0000
commit7bca685c1733a2565a833f1f695e2b740d45b7f6 (patch)
tree05da1cfcf028abae33a5378f9e84662379c5e5a2 /lib/PublicInbox
parent37131af8eb12f6b0d715fd291c885cafec8be577 (diff)
downloadpublic-inbox-7bca685c1733a2565a833f1f695e2b740d45b7f6.tar.gz
Most git processes we invoke don't care about stdin nor stdout,
so don't waste cycles and memory dealing with it.

stderr passing is added `git config --unset-all remotes.fgrptmp'
invocation, though, since that can fail due to I/O errors or OOM.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/LeiMirror.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 2473c74b..7fcb4ebb 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -300,7 +300,7 @@ sub fgrp_update {
                 qw(update-ref --stdin -z) ];
         my $lei = $fgrp->{lei};
         $lei->qerr("# @$cmd");
-        my $opt = { 0 => $r, 1 => $lei->{1}, 2 => $lei->{2} };
+        my $opt = { 0 => $r, 2 => $lei->{2} };
         my $pid = spawn($cmd, undef, $opt);
         close $r or die "close(r): $!";
         for my $ref (keys %dst) {
@@ -332,7 +332,7 @@ sub pack_refs {
         my $cmd = [ 'git', "--git-dir=$git_dir", qw(pack-refs --all --prune) ];
         $self->{lei}->qerr("# @$cmd");
         return if $self->{dry_run};
-        my $opt = { 1 => $self->{lei}->{1}, 2 => $self->{lei}->{2} };
+        my $opt = { 2 => $self->{lei}->{2} };
         $LIVE->{spawn($cmd, undef, $opt)} = [ \&reap_cmd, $self, $cmd ];
 }
 
@@ -344,7 +344,7 @@ sub fgrpv_done {
         pack_refs($first, $first->{-osdir}); # objstore refs always packed
         for my $fgrp (@$fgrpv) {
                 my $rn = $fgrp->{-remote};
-                my %opt = map { $_ => $fgrp->{lei}->{$_} } (0..2);
+                my %opt = ( 2 => $fgrp->{lei}->{2} );
 
                 my $update_ref = $fgrp->{dry_run} ? undef :
                         PublicInbox::OnDestroy->new($$, \&fgrp_update, $fgrp);
@@ -401,7 +401,7 @@ sub fgrp_fetch_all {
                                 $f, '--unset-all', "remotes.$grp"];
                 $self->{lei}->qerr("# @$cmd");
                 if (!$self->{dry_run}) {
-                        $pid = spawn($cmd);
+                        $pid = spawn($cmd, undef, { 2 => $self->{lei}->{2} });
                         waitpid($pid, 0) // die "waitpid: $!";
                         die "E: @$cmd: \$?=$?" if ($? && ($? >> 8) != 5);
 
@@ -518,7 +518,7 @@ sub resume_fetch {
         my ($self, $uri, $fini) = @_;
         my $dst = $self->{cur_dst} // $self->{dst};
         my @git = ('git', "--git-dir=$dst");
-        my $opt = +{ map { $_ => $self->{lei}->{$_} } (0..2) };
+        my $opt = { 2 => $self->{lei}->{2} };
         my $rn = 'origin'; # configurable?
         for ("url=$uri", "fetch=+refs/*:refs/*", 'mirror=true') {
                 my @kv = split(/=/, $_, 2);