user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] multi_git: do not set include.path if already set
@ 2023-02-20  5:32  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-02-20  5:32 UTC (permalink / raw)
  To: meta

The epoch may already be read-only, and we don't need to cause
more I/O traffic and disk wear for no-op stuff.  This fixes
idempotent use of public-inbox-clone to update multi-epoch
inboxes.
---
 lib/PublicInbox/MultiGit.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/MultiGit.pm b/lib/PublicInbox/MultiGit.pm
index 9429a00c..74a9e1df 100644
--- a/lib/PublicInbox/MultiGit.pm
+++ b/lib/PublicInbox/MultiGit.pm
@@ -5,7 +5,7 @@
 package PublicInbox::MultiGit;
 use strict;
 use v5.10.1;
-use PublicInbox::Spawn qw(run_die);
+use PublicInbox::Spawn qw(run_die popen_rd);
 use PublicInbox::Import;
 use File::Temp 0.19;
 use List::Util qw(max);
@@ -108,8 +108,14 @@ sub fill_alternates {
 
 sub epoch_cfg_set {
 	my ($self, $epoch_nr) = @_;
-	run_die([qw(git config -f), epoch_dir($self)."/$epoch_nr.git/config",
-		'include.path', "../../$self->{all}/config" ]);
+	my $f = epoch_dir($self)."/$epoch_nr.git/config";
+	my $v = "../../$self->{all}/config";
+	if (-r $f) {
+		my $rd = popen_rd([qw(git config -f), $f, 'include.path']);
+		chomp(my $have = <$rd> // '');
+		return if $have eq $v;
+	}
+	run_die([qw(git config -f), $f, 'include.path', $v ]);
 }
 
 sub add_epoch {

^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-02-20  5:32  7% [PATCH] multi_git: do not set include.path if already set Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).