summaryrefslogtreecommitdiff
path: root/t/t7407-submodule-foreach.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-12-05 20:53:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-05 20:53:17 (GMT)
commitb2a0afd96a40d6cdbba96ac9735a7b489d8d563e (patch)
tree14e5dc101eef39452a09e743ed2219f9443c9400 /t/t7407-submodule-foreach.sh
parentdaad3aa255ec5c08f95867feaaf8f4db03346e70 (diff)
parent1c4fb136dbad762c9c4350ee79c3474ae8037587 (diff)
downloadgit-b2a0afd96a40d6cdbba96ac9735a7b489d8d563e.zip
git-b2a0afd96a40d6cdbba96ac9735a7b489d8d563e.tar.gz
git-b2a0afd96a40d6cdbba96ac9735a7b489d8d563e.tar.bz2
Merge branch 'ak/submodule-foreach-quoting'
A behavior change, but a worthwhile one: "git submodule foreach" was treating its arguments as part of a single command to be concatenated and passed to a shell, making writing buggy scripts too easy. This patch preserves the old "just pass it to the shell" behavior when a single argument is passed to 'git submodule foreach' and moves to a new "skip the shell and use the arguments passed unmolested" behavior when more than one argument is passed. The old behavior (always concatenating and passing to the shell) was similar to the 'ssh' command, while the new behavior (switching on the number of arguments) is what 'xterm -e' does. May need more thought to make sure this change is advertised well so that scripts that used multiple arguments but added their own extra layer of quoting are not broken. * ak/submodule-foreach-quoting: submodule foreach: skip eval for more than one argument
Diffstat (limited to 't/t7407-submodule-foreach.sh')
-rwxr-xr-xt/t7407-submodule-foreach.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh
index b64c9ed..7ca10b8 100755
--- a/t/t7407-submodule-foreach.sh
+++ b/t/t7407-submodule-foreach.sh
@@ -325,4 +325,13 @@ test_expect_success 'command passed to foreach --recursive retains notion of std
test_cmp expected actual
'
+test_expect_success 'multi-argument command passed to foreach is not shell-evaluated twice' '
+ (
+ cd super &&
+ git submodule foreach "echo \\\"quoted\\\"" > ../expected &&
+ git submodule foreach echo \"quoted\" > ../actual
+ ) &&
+ test_cmp expected actual
+'
+
test_done