Code

t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin
[git.git] / t / t7407-submodule-foreach.sh
index d8ad25036f325ecdcc71257614e19b5e6ab2cdc5..97b7562dbfe510daa86f9888a4a5bc401c789b6c 100755 (executable)
@@ -288,4 +288,22 @@ test_expect_success 'use "update --recursive nested1" to checkout all submodules
        )
 '
 
+test_expect_failure 'command passed to foreach retains notion of stdin' '
+       (
+               cd super &&
+               git submodule foreach echo success >../expected &&
+               yes | git submodule foreach "read y && test \"x\$y\" = xy && echo success" >../actual
+       ) &&
+       test_cmp expected actual
+'
+
+test_expect_failure 'command passed to foreach --recursive retains notion of stdin' '
+       (
+               cd clone2 &&
+               git submodule foreach --recursive echo success >../expected &&
+               yes | git submodule foreach --recursive "read y && test \"x\$y\" = xy && echo success" >../actual
+       ) &&
+       test_cmp expected actual
+'
+
 test_done