about summary refs log tree commit homepage
path: root/lib/PublicInbox/Config.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-09-11 00:19:15 +0000
committerEric Wong <e@80x24.org>2021-09-11 00:24:14 +0000
commita0f0df6e66e6613805fa40c95b9758e4702e248a (patch)
tree4917269ae23efb43e822f82b49eeb515c6b026fb /lib/PublicInbox/Config.pm
parent47ad2954fa34cdc75fa5c56f38f352d77afba553 (diff)
downloadpublic-inbox-a0f0df6e66e6613805fa40c95b9758e4702e248a.tar.gz
lei shouldn't become unusable if a config file is invalid.
Instead, show the "git config" stderr and attempt to continue
gracefully.

Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://public-inbox.org/meta/20210910141157.6u5adehpx7wftkor@meerkat.local/
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r--lib/PublicInbox/Config.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index b3e00ae0..74a1a6f5 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -164,12 +164,12 @@ sub config_fh_parse ($$$) {
 }
 
 sub git_config_dump {
-        my ($class, $file) = @_;
+        my ($class, $file, $errfh) = @_;
         return bless {}, $class unless -e $file;
         my $cmd = [ qw(git config -z -l --includes), "--file=$file" ];
-        my $fh = popen_rd($cmd);
+        my $fh = popen_rd($cmd, undef, { 2 => $errfh // 2 });
         my $rv = config_fh_parse($fh, "\0", "\n");
-        close $fh or die "failed to close (@$cmd) pipe: $?";
+        close $fh or die "@$cmd failed: \$?=$?\n";
         bless $rv, $class;
 }