]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: pass client stderr to git-config in more places
authorEric Wong <e@80x24.org>
Sat, 11 Sep 2021 00:19:16 +0000 (00:19 +0000)
committerEric Wong <e@80x24.org>
Sat, 11 Sep 2021 00:24:15 +0000 (00:24 +0000)
This should improve the users' chances of seeing errors in
various git config files we use.

lib/PublicInbox/Config.pm
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiMirror.pm

index 74a1a6f5a776fd388bed0b9a16b53263f914e03e..ee5322fe142a1507cd1c11a0d9db23a9549ad5d2 100644 (file)
@@ -19,7 +19,7 @@ sub _array ($) { ref($_[0]) eq 'ARRAY' ? $_[0] : [ $_[0] ] }
 # returns key-value pairs of config directives in a hash
 # if keys may be multi-value, the value is an array ref containing all values
 sub new {
-       my ($class, $file) = @_;
+       my ($class, $file, $errfh) = @_;
        $file //= default_file();
        my $self;
        if (ref($file) eq 'SCALAR') { # used by some tests
@@ -27,7 +27,7 @@ sub new {
                $self = config_fh_parse($fh, "\n", '=');
                bless $self, $class;
        } else {
-               $self = git_config_dump($class, $file);
+               $self = git_config_dump($class, $file, $errfh);
                $self->{'-f'} = $file;
        }
        # caches
index 0b4c99dc45dc2cd159e5bdd22847a53a2fad8ff1..aff2bf19ff8534bcea661f0d8ad52a27712a344a 100644 (file)
@@ -820,7 +820,7 @@ sub _lei_cfg ($;$) {
                $cur_st = pack('dd', $st[10], $st[7]);
                qerr($self, "# $f created") if $self->{cmd} ne 'config';
        }
-       my $cfg = PublicInbox::Config->git_config_dump($f);
+       my $cfg = PublicInbox::Config->git_config_dump($f, $self->{2});
        $cfg->{-st} = $cur_st;
        $cfg->{'-f'} = $f;
        if ($sto && canonpath_harder($sto_dir // store_path($self))
index 638add421d61df703001f753b0a9d9e426c609f6..8689b825a0beb397e30389abdd27a80f3a68aafe 100644 (file)
@@ -110,7 +110,7 @@ sub _try_config {
        }
        return $lei->err("# @$cmd failed (non-fatal)") if $cerr;
        rename($f, $ce) or return $lei->err("link($f, $ce): $! (non-fatal)");
-       my $cfg = PublicInbox::Config->git_config_dump($f);
+       my $cfg = PublicInbox::Config->git_config_dump($f, $lei->{2});
        my $ibx = $self->{ibx} = {};
        for my $sec (grep(/\Apublicinbox\./, @{$cfg->{-section_order}})) {
                for (qw(address newsgroup nntpmirror)) {
@@ -136,7 +136,7 @@ sub index_cloned_inbox {
        }
        # force synchronous dwaitpid for v2:
        local $PublicInbox::DS::in_loop = 0;
-       my $cfg = PublicInbox::Config->new;
+       my $cfg = PublicInbox::Config->new(undef, $lei->{2});
        my $env = PublicInbox::Admin::index_prepare($opt, $cfg);
        local %ENV = (%ENV, %$env) if $env;
        PublicInbox::Admin::progress_prepare($opt, $lei->{2});