From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 91BBE1F5A0 for ; Mon, 6 Feb 2023 05:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1675663030; bh=GXAUd0T01HalqS2BDDeYAfr50fb4+SKIFLX1yybghuQ=; h=From:To:Subject:Date:From; b=NgA2TGhjrO1R+HrB2ITaiLVMRTmzW4hPtBUf4BRbaH2spPOepA9XGdcXSEJUuvhlA rmGl4DCzvDxLWgzQw3E5vBKfR/pU9TjXk+/dmy2u/bsl4fV3dcqkNiErbtcxCMiPyU iOfaBAbCCgwozXkEBzl2WBgz3FVapYMBmf+Xei1g= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] lei_mirror: reduce `git config' usage Date: Mon, 6 Feb 2023 05:56:35 +0000 Message-Id: <20230206055635.1159692-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 ];