t7405: cd inside subshell instead of around

Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)`

This ensures that the test doesn't get caught in the subdirectory if there
is an error in the subshell.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jens Lehmann 2010-09-01 23:01:49 +02:00 committed by Junio C Hamano
parent b49c452bb1
commit 1e2847634e

View File

@ -67,7 +67,7 @@ test_expect_success setup '
# b in the main repository. # b in the main repository.
test_expect_success 'setup for merge search' ' test_expect_success 'setup for merge search' '
mkdir merge-search && mkdir merge-search &&
cd merge-search && (cd merge-search &&
git init && git init &&
mkdir sub && mkdir sub &&
(cd sub && (cd sub &&
@ -101,8 +101,7 @@ test_expect_success 'setup for merge search' '
git checkout -b sub-d sub-b && git checkout -b sub-d sub-b &&
git merge sub-c) && git merge sub-c) &&
git commit -a -m "d" && git commit -a -m "d" &&
git branch test b && git branch test b)
cd ..
' '
test_expect_success 'merge with one side as a fast-forward of the other' ' test_expect_success 'merge with one side as a fast-forward of the other' '
@ -126,7 +125,7 @@ test_expect_success 'merging should conflict for non fast-forward' '
' '
test_expect_success 'merging should fail for ambiguous common parent' ' test_expect_success 'merging should fail for ambiguous common parent' '
cd merge-search && (cd merge-search &&
git checkout -b test-ambiguous b && git checkout -b test-ambiguous b &&
(cd sub && (cd sub &&
git checkout -b ambiguous sub-b && git checkout -b ambiguous sub-b &&
@ -136,8 +135,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '
test_must_fail git merge c 2> actual && test_must_fail git merge c 2> actual &&
grep $(cat expect1) actual > /dev/null && grep $(cat expect1) actual > /dev/null &&
grep $(cat expect2) actual > /dev/null && grep $(cat expect2) actual > /dev/null &&
git reset --hard && git reset --hard)
cd ..
' '
# in a situation like this # in a situation like this
@ -158,7 +156,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '
# commits (sub-a) does not descend from the submodule merge-base (sub-b). # commits (sub-a) does not descend from the submodule merge-base (sub-b).
# #
test_expect_success 'merging should fail for changes that are backwards' ' test_expect_success 'merging should fail for changes that are backwards' '
cd merge-search && (cd merge-search &&
git checkout -b bb a && git checkout -b bb a &&
(cd sub && (cd sub &&
git checkout sub-b) && git checkout sub-b) &&
@ -175,16 +173,13 @@ test_expect_success 'merging should fail for changes that are backwards' '
git commit -a -m "f" && git commit -a -m "f" &&
git checkout -b test-backward e && git checkout -b test-backward e &&
test_must_fail git merge f && test_must_fail git merge f)
cd ..
' '
test_expect_success 'merging with a modify/modify conflict between merge bases' ' test_expect_success 'merging with a modify/modify conflict between merge bases' '
git reset --hard HEAD && git reset --hard HEAD &&
git checkout -b test2 c && git checkout -b test2 c &&
git merge d git merge d
' '
test_done test_done