X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/93b8c205b18a69c4e5ae6b9ebe425c328e23c17b..d921399d97e499b69ed5c9ed98cef69e61704791:/vcsh diff --git a/vcsh b/vcsh index af67e18..6ffd964 100755 --- a/vcsh +++ b/vcsh @@ -19,12 +19,12 @@ # If '.git-HEAD' is appended to the version, you are seeing an unreleased # version of vcsh; the master branch is supposed to be clean at all times # so you can most likely just use it nonetheless -VERSION='1.20141025' +VERSION='1.20141026' SELF=$(basename $0) fatal() { echo "$SELF: fatal: $1" >&2 - [ -z $2] && exit 1 + [ -z $2 ] && exit 1 exit $2 } @@ -154,7 +154,8 @@ clone() { git config branch."$VCSH_BRANCH".remote origin git config branch."$VCSH_BRANCH".merge refs/heads/"$VCSH_BRANCH" if [ $(git ls-remote origin "$VCSH_BRANCH" 2> /dev/null | wc -l ) -lt 1 ]; then - info "remote is empty, not merging anything" + info "remote is empty, not merging anything. + You should add files to your new repository." exit fi git fetch origin "$VCSH_BRANCH" @@ -213,6 +214,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 } @@ -545,6 +557,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' ] ||