]> git.madduck.net Git - code/vcsh.git/blobdiff - vcsh

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge branch 'master' into feature/foreach
[code/vcsh.git] / vcsh
diff --git a/vcsh b/vcsh
index afed6eb33abbcc16885365cd560095a3eeb94a9d..18faf4c16dd6bfef4b97eb86029e5ea83f9134c2 100755 (executable)
--- 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' ] ||