We can use `git -c $KEY=$VAL fetch' with a random remote name
that never makes it to a config file.
---
 Still struggling with public-inbox-clone / git-fetch performance
 problems on the linux.git objstore and have several other
 patches pending, but this is useful standalone...

 lib/PublicInbox/LeiMirror.pm | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm
index 4c564c84..f7184240 100644
--- a/lib/PublicInbox/LeiMirror.pm
+++ b/lib/PublicInbox/LeiMirror.pm
@@ -507,12 +507,9 @@ sub resume_fetch {
        my $dst = $self->{cur_dst} // $self->{dst};
        my @git = ('git', "--git-dir=$dst");
        my $opt = { 2 => $self->{lei}->{2} };
-       my $rn = 'origin'; # configurable?
+       my $rn = 'random'.int(rand(1 << 30));
        for ("url=$uri", "fetch=+refs/*:refs/*", 'mirror=true') {
-               my @kv = split(/=/, $_, 2);
-               $kv[0] = "remote.$rn.$kv[0]";
-               next if $self->{dry_run};
-               run_die([@git, 'config', @kv], undef, $opt);
+               push @git, '-c', "remote.$rn.$_";
        }
        my $cmd = [ @{$self->{-torsocks}}, @git,
                        fetch_args($self->{lei}, $opt), $rn ];

Reply via email to