about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-02-06 05:56:35 +0000
committerEric Wong <e@80x24.org>2023-02-06 06:41:51 +0000
commit385a9f395604b0ec99190df2f1a0fb26c896f585 (patch)
tree8d99c8e7aa81bf3c2f67353fe92d56eef3970376
parent0f19ca7e3ca6fc568a8713c5ececdb4d9fa577e6 (diff)
downloadpublic-inbox-385a9f395604b0ec99190df2f1a0fb26c896f585.tar.gz
We can use `git -c $KEY=$VAL fetch' with a random remote name
that never makes it to a config file.
-rw-r--r--lib/PublicInbox/LeiMirror.pm7
1 files 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 ];