]> git.ipfire.org Git - thirdparty/git.git/commit
config tests: fix harmless but broken "rm -r" cleanup
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 30 Jun 2022 10:18:36 +0000 (12:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Jun 2022 20:48:29 +0000 (13:48 -0700)
commiteb1cd60290d3898ef3c3293a11400f9fff9376cd
treeaeac2dfee938684e1e8f0154fbc5c1e4ac50017e
parent361fa321ec25cbbdf21df9309a82e5280c19fa02
config tests: fix harmless but broken "rm -r" cleanup

The "test_when_finished" cleanup phase added in 4179b4897f2 (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 in
4179b4897f2, 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>
t/t1300-config.sh