t3600: slightly modernize style

Remove the space between redirection and file name.
Also remove unnecessary invocations of subshells, such as

	(cd submod &&
		echo X >untracked
	) &&

as there is no point of having the shell for functional purposes.
In case of a single Git command use the `-C` option to let Git cd into
the directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2016-12-12 15:54:55 -08:00 committed by Junio C Hamano
parent 8954bd76eb
commit 9e189f1a5c

View File

@ -111,21 +111,21 @@ test_expect_success 'Remove nonexistent file with --ignore-unmatch' '
' '
test_expect_success '"rm" command printed' ' test_expect_success '"rm" command printed' '
echo frotz > test-file && echo frotz >test-file &&
git add test-file && git add test-file &&
git commit -m "add file for rm test" && git commit -m "add file for rm test" &&
git rm test-file > rm-output && git rm test-file >rm-output &&
test `grep "^rm " rm-output | wc -l` = 1 && test $(grep "^rm " rm-output | wc -l) = 1 &&
rm -f test-file rm-output && rm -f test-file rm-output &&
git commit -m "remove file from rm test" git commit -m "remove file from rm test"
' '
test_expect_success '"rm" command suppressed with --quiet' ' test_expect_success '"rm" command suppressed with --quiet' '
echo frotz > test-file && echo frotz >test-file &&
git add test-file && git add test-file &&
git commit -m "add file for rm --quiet test" && git commit -m "add file for rm --quiet test" &&
git rm --quiet test-file > rm-output && git rm --quiet test-file >rm-output &&
test `wc -l < rm-output` = 0 && test_must_be_empty rm-output &&
rm -f test-file rm-output && rm -f test-file rm-output &&
git commit -m "remove file from rm --quiet test" git commit -m "remove file from rm --quiet test"
' '
@ -221,7 +221,7 @@ test_expect_success 'Call "rm" from outside the work tree' '
mkdir repo && mkdir repo &&
(cd repo && (cd repo &&
git init && git init &&
echo something > somefile && echo something >somefile &&
git add somefile && git add somefile &&
git commit -m "add a file" && git commit -m "add a file" &&
(cd .. && (cd .. &&
@ -287,7 +287,7 @@ test_expect_success 'rm removes empty submodules from work tree' '
git commit -m "add submodule" && git commit -m "add submodule" &&
git rm submod && git rm submod &&
test ! -e submod && test ! -e submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git config -f .gitmodules submodule.sub.url && test_must_fail git config -f .gitmodules submodule.sub.url &&
test_must_fail git config -f .gitmodules submodule.sub.path test_must_fail git config -f .gitmodules submodule.sub.path
@ -298,7 +298,7 @@ test_expect_success 'rm removes removed submodule from index and .gitmodules' '
git submodule update && git submodule update &&
rm -rf submod && rm -rf submod &&
git rm submod && git rm submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git config -f .gitmodules submodule.sub.url && test_must_fail git config -f .gitmodules submodule.sub.url &&
test_must_fail git config -f .gitmodules submodule.sub.path test_must_fail git config -f .gitmodules submodule.sub.path
@ -309,7 +309,7 @@ test_expect_success 'rm removes work tree of unmodified submodules' '
git submodule update && git submodule update &&
git rm submod && git rm submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git config -f .gitmodules submodule.sub.url && test_must_fail git config -f .gitmodules submodule.sub.url &&
test_must_fail git config -f .gitmodules submodule.sub.path test_must_fail git config -f .gitmodules submodule.sub.path
@ -320,7 +320,7 @@ test_expect_success 'rm removes a submodule with a trailing /' '
git submodule update && git submodule update &&
git rm submod/ && git rm submod/ &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -335,17 +335,15 @@ test_expect_success 'rm succeeds when given a directory with a trailing /' '
test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' ' test_expect_success 'rm of a populated submodule with different HEAD fails unless forced' '
git reset --hard && git reset --hard &&
git submodule update && git submodule update &&
(cd submod && git -C submod checkout HEAD^ &&
git checkout HEAD^
) &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.modified actual && test_cmp expect.modified actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git config -f .gitmodules submodule.sub.url && test_must_fail git config -f .gitmodules submodule.sub.url &&
test_must_fail git config -f .gitmodules submodule.sub.path test_must_fail git config -f .gitmodules submodule.sub.path
@ -418,34 +416,30 @@ test_expect_success 'rm issues a warning when section is not found in .gitmodule
test_expect_success 'rm of a populated submodule with modifications fails unless forced' ' test_expect_success 'rm of a populated submodule with modifications fails unless forced' '
git reset --hard && git reset --hard &&
git submodule update && git submodule update &&
(cd submod && echo X >submod/empty &&
echo X >empty
) &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.modified actual && test_cmp expect.modified actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'rm of a populated submodule with untracked files fails unless forced' ' test_expect_success 'rm of a populated submodule with untracked files fails unless forced' '
git reset --hard && git reset --hard &&
git submodule update && git submodule update &&
(cd submod && echo X >submod/untracked &&
echo X >untracked
) &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.modified actual && test_cmp expect.modified actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -461,16 +455,12 @@ test_expect_success 'setup submodule conflict' '
git add nitfol && git add nitfol &&
git commit -m "added nitfol 2" && git commit -m "added nitfol 2" &&
git checkout -b conflict1 master && git checkout -b conflict1 master &&
(cd submod && git -C submod fetch &&
git fetch && git -C submod checkout branch1 &&
git checkout branch1
) &&
git add submod && git add submod &&
git commit -m "submod 1" && git commit -m "submod 1" &&
git checkout -b conflict2 master && git checkout -b conflict2 master &&
(cd submod && git -C submod checkout branch2 &&
git checkout branch2
) &&
git add submod && git add submod &&
git commit -m "submod 2" git commit -m "submod 2"
' '
@ -486,7 +476,7 @@ test_expect_success 'rm removes work tree of unmodified conflicted submodule' '
test_must_fail git merge conflict2 && test_must_fail git merge conflict2 &&
git rm submod && git rm submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -494,18 +484,16 @@ test_expect_success 'rm of a conflicted populated submodule with different HEAD
git checkout conflict1 && git checkout conflict1 &&
git reset --hard && git reset --hard &&
git submodule update && git submodule update &&
(cd submod && git -C submod checkout HEAD^ &&
git checkout HEAD^
) &&
test_must_fail git merge conflict2 && test_must_fail git merge conflict2 &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.conflict actual && test_cmp expect.conflict actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git config -f .gitmodules submodule.sub.url && test_must_fail git config -f .gitmodules submodule.sub.url &&
test_must_fail git config -f .gitmodules submodule.sub.path test_must_fail git config -f .gitmodules submodule.sub.path
@ -515,18 +503,16 @@ test_expect_success 'rm of a conflicted populated submodule with modifications f
git checkout conflict1 && git checkout conflict1 &&
git reset --hard && git reset --hard &&
git submodule update && git submodule update &&
(cd submod && echo X >submod/empty &&
echo X >empty
) &&
test_must_fail git merge conflict2 && test_must_fail git merge conflict2 &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.conflict actual && test_cmp expect.conflict actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git config -f .gitmodules submodule.sub.url && test_must_fail git config -f .gitmodules submodule.sub.url &&
test_must_fail git config -f .gitmodules submodule.sub.path test_must_fail git config -f .gitmodules submodule.sub.path
@ -536,18 +522,16 @@ test_expect_success 'rm of a conflicted populated submodule with untracked files
git checkout conflict1 && git checkout conflict1 &&
git reset --hard && git reset --hard &&
git submodule update && git submodule update &&
(cd submod && echo X >submod/untracked &&
echo X >untracked
) &&
test_must_fail git merge conflict2 && test_must_fail git merge conflict2 &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.conflict actual && test_cmp expect.conflict actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -564,12 +548,12 @@ test_expect_success 'rm of a conflicted populated submodule with a .git director
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -d submod/.git && test -d submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.conflict actual && test_cmp expect.conflict actual &&
test_must_fail git rm -f submod && test_must_fail git rm -f submod &&
test -d submod && test -d submod &&
test -d submod/.git && test -d submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.conflict actual && test_cmp expect.conflict actual &&
git merge --abort && git merge --abort &&
rm -rf submod rm -rf submod
@ -581,7 +565,7 @@ test_expect_success 'rm of a conflicted unpopulated submodule succeeds' '
test_must_fail git merge conflict2 && test_must_fail git merge conflict2 &&
git rm submod && git rm submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -597,12 +581,12 @@ test_expect_success 'rm of a populated submodule with a .git directory fails eve
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -d submod/.git && test -d submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
! test -s actual && ! test -s actual &&
test_must_fail git rm -f submod && test_must_fail git rm -f submod &&
test -d submod && test -d submod &&
test -d submod/.git && test -d submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
! test -s actual && ! test -s actual &&
rm -rf submod rm -rf submod
' '
@ -629,58 +613,52 @@ test_expect_success 'setup subsubmodule' '
test_expect_success 'rm recursively removes work tree of unmodified submodules' ' test_expect_success 'rm recursively removes work tree of unmodified submodules' '
git rm submod && git rm submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'rm of a populated nested submodule with different nested HEAD fails unless forced' ' test_expect_success 'rm of a populated nested submodule with different nested HEAD fails unless forced' '
git reset --hard && git reset --hard &&
git submodule update --recursive && git submodule update --recursive &&
(cd submod/subsubmod && git -C submod/subsubmod checkout HEAD^ &&
git checkout HEAD^
) &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.modified actual && test_cmp expect.modified actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'rm of a populated nested submodule with nested modifications fails unless forced' ' test_expect_success 'rm of a populated nested submodule with nested modifications fails unless forced' '
git reset --hard && git reset --hard &&
git submodule update --recursive && git submodule update --recursive &&
(cd submod/subsubmod && echo X >submod/subsubmod/empty &&
echo X >empty
) &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.modified actual && test_cmp expect.modified actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'rm of a populated nested submodule with nested untracked files fails unless forced' ' test_expect_success 'rm of a populated nested submodule with nested untracked files fails unless forced' '
git reset --hard && git reset --hard &&
git submodule update --recursive && git submodule update --recursive &&
(cd submod/subsubmod && echo X >submod/subsubmod/untracked &&
echo X >untracked
) &&
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -f submod/.git && test -f submod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect.modified actual && test_cmp expect.modified actual &&
git rm -f submod && git rm -f submod &&
test ! -d submod && test ! -d submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
test_cmp expect actual test_cmp expect actual
' '
@ -695,12 +673,12 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
test_must_fail git rm submod && test_must_fail git rm submod &&
test -d submod && test -d submod &&
test -d submod/subsubmod/.git && test -d submod/subsubmod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
! test -s actual && ! test -s actual &&
test_must_fail git rm -f submod && test_must_fail git rm -f submod &&
test -d submod && test -d submod &&
test -d submod/subsubmod/.git && test -d submod/subsubmod/.git &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
! test -s actual && ! test -s actual &&
rm -rf submod rm -rf submod
' '
@ -717,7 +695,7 @@ test_expect_success 'checking out a commit after submodule removal needs manual
echo "?? submod/" >expected && echo "?? submod/" >expected &&
test_cmp expected actual && test_cmp expected actual &&
rm -rf submod && rm -rf submod &&
git status -s -uno --ignore-submodules=none > actual && git status -s -uno --ignore-submodules=none >actual &&
! test -s actual ! test -s actual
' '