]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ms/submodule-foreach-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Jul 2019 19:38:18 +0000 (12:38 -0700)
"git submodule foreach" did not protect command line options passed
to the command to be run in each submodule correctly, when the
"--recursive" option was in use.

* ms/submodule-foreach-fix:
  submodule foreach: fix recursion of options

1  2 
builtin/submodule--helper.c
t/t7407-submodule-foreach.sh

Simple merge
index 706ae762e0ec2fd0103f7f6788eff13ec86ebd67,57e4b7f990d60cd5789a31f0ae20738196191c1d..6b2aa917e11871eb403c8c79725b1e1944f8d29f
@@@ -411,14 -411,11 +411,21 @@@ test_expect_success 'multi-argument com
        test_cmp expected actual
  '
  
 +test_expect_success 'option-like arguments passed to foreach commands are not lost' '
 +      (
 +              cd super &&
 +              git submodule foreach "echo be --quiet" > ../expected &&
 +              git submodule foreach echo be --quiet > ../actual
 +      ) &&
 +      grep -sq -e "--quiet" expected &&
 +      test_cmp expected actual
 +'
 +
+ test_expect_success 'option-like arguments passed to foreach recurse correctly' '
+       git -C clone2 submodule foreach --recursive "echo be --an-option" >expect &&
+       git -C clone2 submodule foreach --recursive echo be --an-option >actual &&
+       grep -e "--an-option" expect &&
+       test_cmp expect actual
+ '
  test_done