config tests: fix harmless but broken "rm -r" cleanup
The "test_when_finished" cleanup phase added in4179b4897f
(config: allow overriding of global and system configuration, 2021-04-19) has never worked as intended, firstly the ".config/git" is a directory, so we'd need the "-r" flag, but more importantly the $HOME variable wasn't properly quoted. We'd thus end up trying to remove the "trash" part of "trash directory", which wouldn't fail with "-f", since "rm -f" won't fail on non-existing files. It's possible that this would have caused an actual failure if someone had a $HOME with a space character in it, such that our "rm -f" would fail to remove an existing directory, but in practice that probably never happened. Let's fix both the quoting issue, and the other issue cleanup issue in4179b4897f
, which is that we were attempting to clean up ~/.config/git, but weren't cleaing up ~/.gitconfig. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
361fa321ec
commit
eb1cd60290
@ -2083,12 +2083,13 @@ test_expect_success '--show-scope with --show-origin' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'override global and system config' '
|
test_expect_success 'override global and system config' '
|
||||||
test_when_finished rm -f "$HOME"/.config/git &&
|
test_when_finished rm -f \"\$HOME\"/.gitconfig &&
|
||||||
|
|
||||||
cat >"$HOME"/.gitconfig <<-EOF &&
|
cat >"$HOME"/.gitconfig <<-EOF &&
|
||||||
[home]
|
[home]
|
||||||
config = true
|
config = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
test_when_finished rm -rf \"\$HOME\"/.config/git &&
|
||||||
mkdir -p "$HOME"/.config/git &&
|
mkdir -p "$HOME"/.config/git &&
|
||||||
cat >"$HOME"/.config/git/config <<-EOF &&
|
cat >"$HOME"/.config/git/config <<-EOF &&
|
||||||
[xdg]
|
[xdg]
|
||||||
|
Loading…
Reference in New Issue
Block a user