Code

Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4'
[git.git] / git-submodule.sh
index cfd5aa60491a88534aeacb7fe70141aa391675a9..87c9452c8a8ae179ffb7e7958ba95688e95bd0e9 100755 (executable)
@@ -304,6 +304,10 @@ cmd_foreach()
 
        toplevel=$(pwd)
 
+       # dup stdin so that it can be restored when running the external
+       # command in the subshell (and a recursive call to this function)
+       exec 3<&0
+
        module_list |
        while read mode sha1 stage path
        do
@@ -320,7 +324,7 @@ cmd_foreach()
                                then
                                        cmd_foreach "--recursive" "$@"
                                fi
-                       ) ||
+                       ) <&3 3<&- ||
                        die "$(eval_gettext "Stopping at '\$path'; script returned non-zero status.")"
                fi
        done