t1092: clean up script quoting

This test was introduced in 19a0acc83e (t1092: test interesting
sparse-checkout scenarios, 2021-01-23), but it contains issues with quoting
that were not noticed until starting this follow-up series. The old
mechanism would drop quoting such as in

   test_all_match git commit -m "touch README.md"

The above happened to work because README.md is a file in the
repository, so 'git commit -m touch REAMDE.md' would succeed by
accident.

Other cases included quoting for no good reason, so clean that up now.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee 2021-03-30 13:10:46 +00:00 committed by Junio C Hamano
parent 0b5fcb08b5
commit 4b3f765a2f

View File

@ -96,20 +96,20 @@ init_repos () {
run_on_sparse () {
(
cd sparse-checkout &&
$* >../sparse-checkout-out 2>../sparse-checkout-err
"$@" >../sparse-checkout-out 2>../sparse-checkout-err
)
}
run_on_all () {
(
cd full-checkout &&
$* >../full-checkout-out 2>../full-checkout-err
"$@" >../full-checkout-out 2>../full-checkout-err
) &&
run_on_sparse $*
run_on_sparse "$@"
}
test_all_match () {
run_on_all $* &&
run_on_all "$@" &&
test_cmp full-checkout-out sparse-checkout-out &&
test_cmp full-checkout-err sparse-checkout-err
}
@ -119,7 +119,7 @@ test_expect_success 'status with options' '
test_all_match git status --porcelain=v2 &&
test_all_match git status --porcelain=v2 -z -u &&
test_all_match git status --porcelain=v2 -uno &&
run_on_all "touch README.md" &&
run_on_all touch README.md &&
test_all_match git status --porcelain=v2 &&
test_all_match git status --porcelain=v2 -z -u &&
test_all_match git status --porcelain=v2 -uno &&
@ -135,7 +135,7 @@ test_expect_success 'add, commit, checkout' '
write_script edit-contents <<-\EOF &&
echo text >>$1
EOF
run_on_all "../edit-contents README.md" &&
run_on_all ../edit-contents README.md &&
test_all_match git add README.md &&
test_all_match git status --porcelain=v2 &&
@ -144,7 +144,7 @@ test_expect_success 'add, commit, checkout' '
test_all_match git checkout HEAD~1 &&
test_all_match git checkout - &&
run_on_all "../edit-contents README.md" &&
run_on_all ../edit-contents README.md &&
test_all_match git add -A &&
test_all_match git status --porcelain=v2 &&
@ -153,7 +153,7 @@ test_expect_success 'add, commit, checkout' '
test_all_match git checkout HEAD~1 &&
test_all_match git checkout - &&
run_on_all "../edit-contents deep/newfile" &&
run_on_all ../edit-contents deep/newfile &&
test_all_match git status --porcelain=v2 -uno &&
test_all_match git status --porcelain=v2 &&
@ -186,7 +186,7 @@ test_expect_success 'diff --staged' '
write_script edit-contents <<-\EOF &&
echo text >>README.md
EOF
run_on_all "../edit-contents" &&
run_on_all ../edit-contents &&
test_all_match git diff &&
test_all_match git diff --staged &&
@ -280,7 +280,7 @@ test_expect_success 'clean' '
echo bogus >>.gitignore &&
run_on_all cp ../.gitignore . &&
test_all_match git add .gitignore &&
test_all_match git commit -m ignore-bogus-files &&
test_all_match git commit -m "ignore bogus files" &&
run_on_sparse mkdir folder1 &&
run_on_all touch folder1/bogus &&