X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fdiv0-gittools.git;a=blobdiff_plain;f=git-recurse;h=17959bdae1215094cf30c65d674d803b946bb5bd;hp=5a373da3789ce30e79715180b8649248909b0120;hb=a55cffa57fd814947e86bde4dfdf88af06d57e02;hpb=d353f16e21ca906dc2b1ace0cddb308d76a08a91 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