{"thread":{"id":"24944","subject":"[PATCH] t7405: cd inside subshell instead of around","startedAt":"2010-09-01T21:01:49Z","lastAt":"2010-09-02T16:29:36Z","messageCount":2,"participants":["Jens Lehmann","Heiko Voigt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"149607","messageId":"4C7EBF3D.9030806@web.de","threadId":"24944","inReplyTo":null,"subject":"[PATCH] t7405: cd inside subshell instead of around","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2010-09-01T21:01:49Z","receivedAt":"2010-09-01T21:01:49Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)`\n\nThis ensures that the test doesn't get caught in the subdirectory if there\nis an error in the subshell.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n t/t7405-submodule-merge.sh |   17 ++++++-----------\n 1 files changed, 6 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t7405-submodule-merge.sh b/t/t7405-submodule-merge.sh\nindex 6ec559d..7e2e258 100755\n--- a/t/t7405-submodule-merge.sh\n+++ b/t/t7405-submodule-merge.sh\n@@ -67,7 +67,7 @@ test_expect_success setup '\n # b in the main repository.\n test_expect_success 'setup for merge search' '\n \tmkdir merge-search &&\n-\tcd merge-search &&\n+\t(cd merge-search &&\n \tgit init &&\n \tmkdir sub &&\n \t(cd sub &&\n@@ -101,8 +101,7 @@ test_expect_success 'setup for merge search' '\n \t git checkout -b sub-d sub-b &&\n \t git merge sub-c) &&\n \tgit commit -a -m \"d\" &&\n-\tgit branch test b &&\n-\tcd ..\n+\tgit branch test b)\n '\n\n test_expect_success 'merge with one side as a fast-forward of the other' '\n@@ -126,7 +125,7 @@ test_expect_success 'merging should conflict for non fast-forward' '\n '\n\n test_expect_success 'merging should fail for ambiguous common parent' '\n-\tcd merge-search &&\n+\t(cd merge-search &&\n \tgit checkout -b test-ambiguous b &&\n \t(cd sub &&\n \t git checkout -b ambiguous sub-b &&\n@@ -136,8 +135,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '\n \ttest_must_fail git merge c 2> actual &&\n \tgrep $(cat expect1) actual > /dev/null &&\n \tgrep $(cat expect2) actual > /dev/null &&\n-\tgit reset --hard &&\n-\tcd ..\n+\tgit reset --hard)\n '\n\n # in a situation like this\n@@ -158,7 +156,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '\n # commits (sub-a) does not descend from the submodule merge-base (sub-b).\n #\n test_expect_success 'merging should fail for changes that are backwards' '\n-\tcd merge-search &&\n+\t(cd merge-search &&\n \tgit checkout -b bb a &&\n \t(cd sub &&\n \t git checkout sub-b) &&\n@@ -175,16 +173,13 @@ test_expect_success 'merging should fail for changes that are backwards' '\n \tgit commit -a -m \"f\" &&\n\n \tgit checkout -b test-backward e &&\n-\ttest_must_fail git merge f &&\n-\tcd ..\n+\ttest_must_fail git merge f)\n '\n\n test_expect_success 'merging with a modify/modify conflict between merge bases' '\n-\n \tgit reset --hard HEAD &&\n \tgit checkout -b test2 c &&\n \tgit merge d\n-\n '\n\n test_done\n-- \n1.7.2.2.552.gabce9\n"},{"id":"149656","messageId":"20100902162936.GA2535@book.hvoigt.net","threadId":"24944","inReplyTo":"4C7EBF3D.9030806@web.de","subject":"Re: [PATCH] t7405: cd inside subshell instead of around","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2010-09-02T16:29:36Z","receivedAt":"2010-09-02T16:29:36Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"On Wed, Sep 01, 2010 at 11:01:49PM +0200, Jens Lehmann wrote:\n> Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)`\n> \n> This ensures that the test doesn't get caught in the subdirectory if there\n> is an error in the subshell.\n> \n> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n\nThat makes the test way more robust, I like it.\n\ncheers Heiko\n"}]}