From a64bee92230a99413965d160d6ab2f25f16c9208 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 20 Oct 2010 16:26:24 +0200 Subject: [PATCH] better handle stdin --- git-recurse | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-recurse b/git-recurse index 5a373da..17959bd 100755 --- a/git-recurse +++ b/git-recurse @@ -79,16 +79,19 @@ processargs() "$@" } +# save stdin +exec 3<&0 + # recurse through all sub-repos status=0 # TODO is there a better way to identify all sub-repos? -for GITDIR in `find . -type d -name \*.git -prune`; do +find . -type d -name \*.git -prune | while IFS= read -r GITDIR; do # TODO I would LIKE to do this, but then some commands (like pull) fail #export GIT_DIR="$GITDIR" #export GIT_WORK_TREE="${GITDIR%/.git}" # so I will have to chdir instead - ( cd "$GITDIR/.." && processargs git "$@" ) + ( cd "$GITDIR/.." && processargs git "$@" <&3 3<&- ) # use restored stdin if [ "$?" -gt "$status" ]; then status=$? fi -- 2.39.2