X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=git-recurse;h=17959bdae1215094cf30c65d674d803b946bb5bd;hb=HEAD;hp=a1604e13c6375e10a85057d505f3e469a968725d;hpb=22fcf4b0ab0d04d3b5f23a857a45cadcee167236;p=xonotic%2Fdiv0-gittools.git diff --git a/git-recurse b/git-recurse index a1604e1..17959bd 100755 --- a/git-recurse +++ b/git-recurse @@ -79,15 +79,19 @@ processargs() "$@" } +# save stdin +exec 3<&0 + # recurse through all sub-repos status=0 -for GITDIR in `find . -type d -name \*.git`; do +# TODO is there a better way to identify all sub-repos? +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