- export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
-elif [ "$1" = 'delete' ] ||
- [ "$1" = 'enter' ] ||
- [ "$1" = 'init' ] ||
- [ "$1" = 'rename' ] ||
- [ "$1" = 'run' ] ||
- [ "$1" = 'seed-gitignore' ] ||
- [ "$1" = 'setup' ]; then
- [ -z $2 ] && fatal "$1: please specify repository to work on" 1
- [ "$1" = 'rename' -a -z "$3" ] && fatal "$1: please specify a target name" 1
- [ "$1" = 'run' -a -z "$3" ] && fatal "$1: please specify a command" 1
- export VCSH_COMMAND="$1"
- export VCSH_REPO_NAME="$2"
- export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
- [ "$VCSH_COMMAND" = 'rename' ] && export GIT_DIR_NEW="$VCSH_BASE/$3.git"
- [ "$VCSH_COMMAND" = 'run' ] && shift 2 && export VCSH_EXTERNAL_COMMAND="$@"
- [ "$VCSH_COMMAND" = 'seed-gitignore' ] && export VCSH_COMMAND='seed_gitignore'
-elif [ "$1" = 'list' ]; then
- export VCSH_COMMAND="$1"
-elif [ -n "$1" ]; then
- export VCSH_COMMAND=run
- export VCSH_REPO_NAME="$1"
- export GIT_DIR="$VCSH_BASE/$VCSH_REPO_NAME.git"
- [ -d $GIT_DIR ] || { help; exit 1; }
+ [ -n "$VCSH_BRANCH" ] || VCSH_BRANCH=master
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+elif [ "$VCSH_COMMAND" = 'version' ]; then
+ echo "$SELF $VERSION"
+ git version
+ exit
+elif [ x"$VCSH_COMMAND" = x'which' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a filename" 1
+ [ -n "$3" ] && fatal "$VCSH_COMMAND: too many parameters" 1
+ VCSH_COMMAND_PARAMETER=$2; export VCSH_COMMAND_PARAMETER
+elif [ x"$VCSH_COMMAND" = x'delete' ] ||
+ [ x"$VCSH_COMMAND" = x'enter' ] ||
+ [ x"$VCSH_COMMAND" = x'init' ] ||
+ [ x"$VCSH_COMMAND" = x'list-tracked-by' ] ||
+ [ x"$VCSH_COMMAND" = x'rename' ] ||
+ [ x"$VCSH_COMMAND" = x'run' ] ||
+ [ x"$VCSH_COMMAND" = x'upgrade' ] ||
+ [ x"$VCSH_COMMAND" = x'write-gitignore' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify repository to work on" 1
+ [ x"$VCSH_COMMAND" = x'rename' ] && [ -z "$3" ] && fatal "$VCSH_COMMAND: please specify a target name" 1
+ [ x"$VCSH_COMMAND" = x'run' ] && [ -z "$3" ] && fatal "$VCSH_COMMAND: please specify a command" 1
+ VCSH_REPO_NAME=$2; export VCSH_REPO_NAME
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+ [ 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' ] ||
+ [ x"$VCSH_COMMAND" = x'list-untracked' ] ||
+ [ x"$VCSH_COMMAND" = x'pull' ] ||
+ [ x"$VCSH_COMMAND" = x'push' ]; then
+ :
+elif [ x"$VCSH_COMMAND" = x'status' ]; then
+ if [ x"$2" = x'--terse' ]; then
+ VCSH_STATUS_TERSE=1; export VCSH_STATUS_TERSE
+ shift
+ fi
+ VCSH_REPO_NAME=$2; export VCSH_REPO_NAME
+elif [ -n "$2" ]; then
+ VCSH_COMMAND='run'; export VCSH_COMMAND
+ VCSH_REPO_NAME=$1; export VCSH_REPO_NAME
+ GIT_DIR=$VCSH_REPO_D/$VCSH_REPO_NAME.git; export GIT_DIR
+ [ -d "$GIT_DIR" ] || { help; exit 1; }