+debug `git version`
+
+if [ ! "x$VCSH_GITIGNORE" = 'xexact' ] && [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && [ ! "x$VCSH_GITIGNORE" = 'xrecursive' ]; then
+ fatal "'\$VCSH_GITIGNORE' must equal 'exact', 'none', or 'recursive'" 1
+fi
+
+export VCSH_COMMAND="$1"
+
+case "$VCSH_COMMAND" in
+ clon|clo|cl) VCSH_COMMAND=clone;;
+ commi|comm|com|co) VCSH_COMMAND=commit;;
+ delet|dele|del|de) VCSH_COMMAND=delete;;
+ ente|ent|en) VCSH_COMMAND=enter;;
+ hel|he) VCSH_COMMAND=help;;
+ ini|in) VCSH_COMMAND=init;;
+ pul) VCSH_COMMAND=pull;;
+ pus) VCSH_COMMAND=push;;
+ renam|rena|ren|re) VCSH_COMMAND=rename;;
+ ru) VCSH_COMMAND=run;;
+ statu|stat|sta|st) VCSH_COMMAND=status;;
+ upgrad|upgra|upgr|up) VCSH_COMMAND=upgrade;;
+ versio|versi|vers|ver|ve) VCSH_COMMAND=version;;
+ which|whi|wh) VCSH_COMMAND=which;;
+ write|writ|wri|wr) VCSH_COMMAND=write-gitignore;;
+esac
+
+if [ "$VCSH_COMMAND" = 'clone' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1
+ GIT_REMOTE="$2"
+ [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "$GIT_REMOTE" .git)
+ [ -z "$VCSH_REPO_NAME" ] && fatal "$VCSH_COMMAND: could not determine repository name" 1
+ export VCSH_REPO_NAME
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+elif [ "$VCSH_COMMAND" = 'version' ]; then
+ echo "$SELF $VERSION"
+ git version
+ exit
+elif [ "$VCSH_COMMAND" = 'which' ]; then
+ [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a filename" 1
+ [ -n "$3" ] && fatal "$VCSH_COMMAND: too many parameters" 1
+ export VCSH_COMMAND_PARAMETER="$2"
+elif [ "$VCSH_COMMAND" = 'delete' ] ||
+ [ "$VCSH_COMMAND" = 'enter' ] ||
+ [ "$VCSH_COMMAND" = 'init' ] ||
+ [ "$VCSH_COMMAND" = 'list-tracked-by' ] ||
+ [ "$VCSH_COMMAND" = 'rename' ] ||
+ [ "$VCSH_COMMAND" = 'run' ] ||
+ [ "$VCSH_COMMAND" = 'upgrade' ] ||
+ [ "$VCSH_COMMAND" = 'write-gitignore' ]; then
+ [ -z $2 ] && fatal "$VCSH_COMMAND: please specify repository to work on" 1
+ [ "$VCSH_COMMAND" = 'rename' -a -z "$3" ] && fatal "$VCSH_COMMAND: please specify a target name" 1
+ [ "$VCSH_COMMAND" = 'run' -a -z "$3" ] && fatal "$VCSH_COMMAND: please specify a command" 1
+ export VCSH_REPO_NAME="$2"
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ [ "$VCSH_COMMAND" = 'rename' ] && { export VCSH_REPO_NAME_NEW="$3";
+ export GIT_DIR_NEW="$VCSH_REPO_D/$VCSH_REPO_NAME_NEW.git"; }
+ [ "$VCSH_COMMAND" = 'run' ] && shift 2
+elif [ "$VCSH_COMMAND" = 'commit' ] ||
+ [ "$VCSH_COMMAND" = 'list' ] ||
+ [ "$VCSH_COMMAND" = 'list-tracked' ] ||
+ [ "$VCSH_COMMAND" = 'pull' ] ||
+ [ "$VCSH_COMMAND" = 'push' ]; then
+ :
+elif [ "$VCSH_COMMAND" = 'status' ]; then
+ export VCSH_REPO_NAME="$2"
+elif [ -n "$2" ]; then
+ export VCSH_COMMAND='run'
+ export VCSH_REPO_NAME="$1"
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ [ -d $GIT_DIR ] || { help; exit 1; }
+ shift 1
+ set -- "git" "$@"
+elif [ -n "$VCSH_COMMAND" ]; then
+ export VCSH_COMMAND='enter'
+ export VCSH_REPO_NAME="$1"
+ export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"
+ [ -d $GIT_DIR ] || { help; exit 1; }