Re: [PATCH] t5614: don't use subshells
flat view
From: Junio C Hamano <hidden>
Date: 2016-06-21 19:18:37
Stefan Beller [off-list ref] writes:
Unlike the prior patch we would not want this patch to fall through to origin/maint fast, but allow cooking?
I do not see anything that makes this treated differently from the other fix. The only difference in behaviour is that "lines" file is now created at the root level of the trash repository's working tree instead of tested clones', and I do not think any test depends on the number of untracked paths in the trash working tree or tries to make sure a file called "lines" is not in there.
quoted hunk
diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh index a9aaa01..da2a67f 100755 --- a/t/t5614-clone-submodules.sh +++ b/t/t5614-clone-submodules.sh@@ -25,76 +25,46 @@ test_expect_success 'setup' ' test_expect_success 'nonshallow clone implies nonshallow submodule' ' test_when_finished "rm -rf super_clone" && git clone --recurse-submodules "file://$pwd/." super_clone && - ( - cd super_clone && - git log --oneline >lines && - test_line_count = 3 lines - ) && - ( - cd super_clone/sub && - git log --oneline >lines && - test_line_count = 3 lines - ) + git -C super_clone log --oneline >lines && + test_line_count = 3 lines && + git -C super_clone/sub log --oneline >lines && + test_line_count = 3 lines '
Having said that, I wonder if we want further reduction of the
repetition. Each test except "setup" in this script does an
identical thing with very small set of parameters:
- make sure super_clone will be removed when done.
- clone file://$pwd/. to super_clone but with different set of options.
- check the commits in super_clone and super_clone/sub.
So, the above would ideally become something like
do_test 3 3 --recurse-submodules
where the helper would look like
do_test () {
cnt_super=$1 cnt_sub=$2 &&
shift 2 &&
test_when_finished "rm -fr super_clone" &&
git clone "$@" "file://$pwd/." super_clone &&
git -C super_clone log --oneline >lines &&
test_line_count = $cnt_super lines &&
git -C super_clone/sub log --oneline >lines &&
test_line_count = $cnt_sub lines
}
Would it rob too much flexibility from future tests to be added to
this script if we did it that way?