diff options
author | Eric Wong <e@80x24.org> | 2021-09-11 00:19:15 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-11 00:24:14 +0000 |
commit | a0f0df6e66e6613805fa40c95b9758e4702e248a (patch) | |
tree | 4917269ae23efb43e822f82b49eeb515c6b026fb /t | |
parent | 47ad2954fa34cdc75fa5c56f38f352d77afba553 (diff) | |
download | public-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 't')
-rw-r--r-- | t/lei-q-save.t | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/lei-q-save.t b/t/lei-q-save.t index 743a7b70..9c17a011 100644 --- a/t/lei-q-save.t +++ b/t/lei-q-save.t @@ -215,5 +215,22 @@ test_lei(sub { 'absolute path appears in ls-search'; lei_ok qw(up ../s -C), "$home/v2s", \'relative lei up'; lei_ok qw(up), "$home/s", \'absolute lei up'; + + # mess up a config file + my @lss = glob("$home/" . + '.local/share/lei/saved-searches/*/lei.saved-search'); + my $out = xqx([qw(git config -f), $lss[0], 'lei.q.output']); + xsys($^X, qw(-i -p -e), "s/\\[/\\0/", $lss[0]) + and xbail "-ipe $lss[0]: $?"; + lei_ok qw(ls-search); + like($lei_err, qr/bad config line.*?\Q$lss[0]\E/, + 'git config parse error shown w/ lei ls-search'); + lei_ok qw(up --all), \'up works with bad config'; + like($lei_err, qr/bad config line.*?\Q$lss[0]\E/, + 'git config parse error shown w/ lei up'); + xsys($^X, qw(-i -p -e), "s/\\0/\\[/", $lss[0]) + and xbail "-ipe $lss[0]: $?"; + lei_ok qw(ls-search); + is($lei_err, '', 'no errors w/ fixed config'); }); done_testing; |