]> git.ipfire.org Git - thirdparty/git.git/commit
t0602: use subshell to ensure working directory unchanged
authorshejialuo <shejialuo@gmail.com>
Thu, 27 Feb 2025 16:05:55 +0000 (00:05 +0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Feb 2025 22:03:07 +0000 (14:03 -0800)
commit320f2061b63b0157ea8b21362ed12e4ce90258e2
tree129648ffbf28577adc6851c77b3a599e869d7a01
parente63e62171b489dad8ae9d8bd4675b1938bff92c8
t0602: use subshell to ensure working directory unchanged

For every test, we would execute the command "cd repo" in the first but
we never execute the command "cd .." to restore the working directory.
However, it's either not a good idea use above way. Because if any test
fails between "cd repo" and "cd ..", the "cd .." will never be reached.
And we cannot correctly restore the working directory.

Let's use subshell to ensure that the current working directory could be
restored to the correct path.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: shejialuo <shejialuo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0602-reffiles-fsck.sh