diff options
author | Eric Wong <e@80x24.org> | 2023-09-24 05:42:13 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-09-24 18:56:08 +0000 |
commit | f170d220f8765e952c9a102dd35eb694810739df (patch) | |
tree | ab3baa8c8c2775f2b74da1f871980603da19586d /lib/PublicInbox/LeiMirror.pm | |
parent | b4b22d40c52584836d7c0c97a513dfac1c12fbee (diff) | |
download | public-inbox-f170d220f8765e952c9a102dd35eb694810739df.tar.gz |
We can pass `-c NAME=VALUE' args directly to git-config without needing a temporary directory nor file. Furthermore, this opens the door to us being able to correctly handle `-c NAME=VALUE' after `delete $lei->{cfg}' if we need to reload the config during a command. This tightens up error-checking for `lei config' and ensures we can make config settings changes while using `-c NAME=VALUE' instead of editing the temporary file. The non-obvious part was avoiding the use of the -f/--file arg for `git config' for read-only operations and include relying on `-c include.path=$ABS_PATH'. This is done by parsing the switches to be passed to `git config' to determine if it's a read-only operation or not.
Diffstat (limited to 'lib/PublicInbox/LeiMirror.pm')
-rw-r--r-- | lib/PublicInbox/LeiMirror.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index bed034f1..fed6b668 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -193,7 +193,8 @@ sub _write_inbox_config { } elsif (!$!{EEXIST}) { die "open($f): $!"; } - my $cfg = PublicInbox::Config->git_config_dump($f, $self->{lei}->{2}); + my $cfg = PublicInbox::Config->git_config_dump($f, + { 2 => $self->{lei}->{2} }); my $ibx = $self->{ibx} = {}; # for indexing for my $sec (grep(/\Apublicinbox\./, @{$cfg->{-section_order}})) { for (qw(address newsgroup nntpmirror)) { @@ -238,7 +239,7 @@ sub index_cloned_inbox { } # force synchronous awaitpid for v2: local $PublicInbox::DS::in_loop = 0; - my $cfg = PublicInbox::Config->new(undef, $lei->{2}); + my $cfg = PublicInbox::Config->new(undef, { 2 => $lei->{2} }); my $env = PublicInbox::Admin::index_prepare($opt, $cfg); local %ENV = (%ENV, %$env) if $env; PublicInbox::Admin::progress_prepare($opt, $lei->{2}); |