Avoid using `cd` outside of subshells since, if the test fails,
there is no guarantee that the current working directory is the
expected one, which may cause subsequent tests to run in the wrong
directory.
While at it, make some other tests more concise by replacing
simple subshells with `git -C`.
Signed-off-by: Shubham Verma <shubhunic@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Shubham Verma4 years agocommitted byJunio C Hamano
test_expect_success 'moving the file out of subdirectory' '
cd path0 && git mv COPYING ../path1/COPYING
git -C path0 mv COPYING ../path1/COPYING
'
# in path0 currently
test_expect_success 'commiting the change' '
cd .. && git commit -m move-out -a
git commit -m move-out -a
'
test_expect_success 'checking the commit' '
@ -25,12 +25,12 @@ test_expect_success 'checking the commit' '
@@ -25,12 +25,12 @@ test_expect_success 'checking the commit' '
'
test_expect_success 'moving the file back into subdirectory' '
cd path0 && git mv ../path1/COPYING COPYING
git -C path0 mv ../path1/COPYING COPYING
'
# in path0 currently
test_expect_success 'commiting the change' '
cd .. && git commit -m move-in -a
git commit -m move-in -a
'
test_expect_success 'checking the commit' '
@ -328,10 +328,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
@@ -328,10 +328,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and no .gitm
@ -351,10 +348,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
@@ -351,10 +348,7 @@ test_expect_success 'git mv moves a submodule with a .git directory and .gitmodu
@ -396,10 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
@@ -396,10 +384,7 @@ test_expect_success 'mv does not complain when no .gitmodules file is found' '
@ -420,10 +405,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
@@ -420,10 +405,7 @@ test_expect_success 'mv will error out on a modified .gitmodules file unless sta
@ -441,10 +423,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule
@@ -441,10 +423,7 @@ test_expect_success 'mv issues a warning when section is not found in .gitmodule