unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] lei_mirror: reduce `git config' usage
@ 2023-02-06  5:56 Eric Wong
  2023-02-10  1:59 ` mirror performance [was: [PATCH] lei_mirror: reduce `git config' usage] Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2023-02-06  5:56 UTC (permalink / raw)
  To: meta

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 ];

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* mirror performance [was: [PATCH] lei_mirror: reduce `git config' usage]
  2023-02-06  5:56 [PATCH] lei_mirror: reduce `git config' usage Eric Wong
@ 2023-02-10  1:59 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2023-02-10  1:59 UTC (permalink / raw)
  To: meta

Eric Wong <e@80x24.org> wrote:
>  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...

I'm thinking this proposal to use hideRefs (or something like it)
will be useful for fetch performance:
https://public-inbox.org/git/20230209122857.M669733@dcvr/
("[RFC] fetch: support hideRefs to speed up connectivity checks")

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-10  1:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06  5:56 [PATCH] lei_mirror: reduce `git config' usage Eric Wong
2023-02-10  1:59 ` mirror performance [was: [PATCH] lei_mirror: reduce `git config' usage] Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).