summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-16 11:23:26 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-16 11:23:26 -0700
commitd5c756e99ed7aa07427295b1011edf4718ea80b0 (patch)
tree5891cf85b913b5f363cfce727cef7f99a972b488 /git-submodule.sh
parent824f4a93890b06d47d46f87b146022266977b2a9 (diff)
parent4dca1aa6502a46f8d7b6ecc8e7812c5c23ad0923 (diff)
downloadgit-d5c756e99ed7aa07427295b1011edf4718ea80b0.tar.gz
Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4' into maint
* bc/submodule-foreach-stdin-fix-1.7.4: git-submodule.sh: preserve stdin for the command spawned by foreach t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index d189a24c71..9c6dca5a15 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -300,6 +300,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
@@ -316,7 +320,7 @@ cmd_foreach()
then
cmd_foreach "--recursive" "$@"
fi
- ) ||
+ ) <&3 3<&- ||
die "Stopping at '$path'; script returned non-zero status."
fi
done