}
SELF=$(basename $0)
-VERSION='1.20130829'
+VERSION='1.20130909'
fatal() {
echo "$SELF: fatal: $1" >&2
[ -z "$VCSH_HOOK_D" ] && VCSH_HOOK_D="$XDG_CONFIG_HOME/vcsh/hooks-enabled"
[ -z "$VCSH_BASE" ] && VCSH_BASE="$HOME"
[ -z "$VCSH_GITIGNORE" ] && VCSH_GITIGNORE='exact'
+[ -z "$VCSH_WORKTREE" ] && VCSH_WORKTREE='absolute'
+
+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
+
+if [ ! "x$VCSH_WORKTREE" = 'xabsolute' ] && [ ! "x$VCSH_WORKTREE" = 'xrelative' ]; then
+ fatal "'\$VCSH_WORKTREE' must equal 'absolute', or 'relative'" 1
+fi
help() {
# because otherwise Git complains "fatal: core.bare and core.worktree
# do not make sense"
git config core.bare false
- # in core.worktree, keep a relative reference to the base directory
- git config core.worktree $(cd $GIT_DIR && GIT_WORK_TREE="$VCSH_BASE" git rev-parse --show-cdup)
+ # core.worktree may be absolute or relative to $GIT_DIR, depending on
+ # user preference
+ if [ ! "x$VCSH_WORKTREE" = 'xabsolute' ]; then
+ git config core.worktree $(cd $GIT_DIR && GIT_WORK_TREE="$VCSH_BASE" git rev-parse --show-cdup)
+ elif [ ! "x$VCSH_WORKTREE" = 'xrelative' ]; then
+ git config core.worktree "$VCSH_BASE"
+ fi
[ ! "x$VCSH_GITIGNORE" = 'xnone' ] && git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME"
git config vcsh.vcsh 'true'
use
fatal "could not move '$tempfile' to '$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME'" 53
}
-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
-
if [ "$1" = 'clone' ]; then
[ -z "$2" ] && fatal "$1: please specify a remote" 1
export VCSH_COMMAND="$1"