From: Richard Hartmann Date: Fri, 18 Dec 2015 20:37:20 +0000 (+0100) Subject: Merge branch 'master' into feature/foreach X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/1a142e0ce3cfb86f61fb7f97291f29081c275f58?hp=195dd8c17928cddb92bce06182631cbd0d82f4af Merge branch 'master' into feature/foreach --- diff --git a/vcsh b/vcsh index afed6eb..18faf4c 100755 --- a/vcsh +++ b/vcsh @@ -216,6 +216,17 @@ enter() { hook post-enter } +foreach() { + hook pre-foreach + for VCSH_REPO_NAME in $(list); do + echo "$VCSH_REPO_NAME:" + GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR + use + git "$@" + done + hook post-foreach +} + git_dir_exists() { [ -d "$GIT_DIR" ] || fatal "no repository found for '$VCSH_REPO_NAME'" 12 } @@ -558,6 +569,9 @@ elif [ x"$VCSH_COMMAND" = x'delete' ] || [ x"$VCSH_COMMAND" = x'rename' ] && { VCSH_REPO_NAME_NEW=$3; export VCSH_REPO_NAME_NEW; GIT_DIR_NEW=$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git; export GIT_DIR_NEW; } [ x"$VCSH_COMMAND" = x'run' ] && shift 2 +elif [ x"$VCSH_COMMAND" = x'foreach' ]; then + [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a command" 1 + shift 1 elif [ x"$VCSH_COMMAND" = x'commit' ] || [ x"$VCSH_COMMAND" = x'list' ] || [ x"$VCSH_COMMAND" = x'list-tracked' ] ||