Skip to content
Snippets Groups Projects
Commit e85f20d4 authored by Richard Hartmann's avatar Richard Hartmann
Browse files

vcsh: Add support for choosing relative or absolute core.worktree

parent 6927829e
No related branches found
No related tags found
No related merge requests found
...@@ -184,6 +184,15 @@ Interesting knobs you can turn: ...@@ -184,6 +184,15 @@ Interesting knobs you can turn:
Defaults to <exact>. Defaults to <exact>.
* <$VCSH_VCSH_WORKTREE>:
Can be <absolute>, or <relative>.
<absolute> will set an absolute path; defaulting to <$HOME>.
<relative> will set a path relative to <$GIT_DIR>.
Defaults to <absolute>.
Less interesting knobs you could turn: Less interesting knobs you could turn:
* <$VCSH_DEBUG>: * <$VCSH_DEBUG>:
......
...@@ -81,6 +81,11 @@ fi ...@@ -81,6 +81,11 @@ fi
[ -z "$VCSH_HOOK_D" ] && VCSH_HOOK_D="$XDG_CONFIG_HOME/vcsh/hooks-enabled" [ -z "$VCSH_HOOK_D" ] && VCSH_HOOK_D="$XDG_CONFIG_HOME/vcsh/hooks-enabled"
[ -z "$VCSH_BASE" ] && VCSH_BASE="$HOME" [ -z "$VCSH_BASE" ] && VCSH_BASE="$HOME"
[ -z "$VCSH_GITIGNORE" ] && VCSH_GITIGNORE='exact' [ -z "$VCSH_GITIGNORE" ] && VCSH_GITIGNORE='exact'
[ -z "$VCSH_WORKTREE" ] && VCSH_WORKTREE='absolute'
if [ ! "x$VCSH_WORKTREE" = 'xabsolute' ] && [ ! "x$VCSH_WORKTREE" = 'xrelative' ]; then
fatal "'\$VCSH_WORKTREE' must equal 'absolute', or 'relative'" 1
fi
help() { help() {
...@@ -313,8 +318,13 @@ upgrade() { ...@@ -313,8 +318,13 @@ upgrade() {
# because otherwise Git complains "fatal: core.bare and core.worktree # because otherwise Git complains "fatal: core.bare and core.worktree
# do not make sense" # do not make sense"
git config core.bare false git config core.bare false
# in core.worktree, keep a relative reference to the base directory # 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) 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" [ ! "x$VCSH_GITIGNORE" = 'xnone' ] && git config core.excludesfile ".gitignore.d/$VCSH_REPO_NAME"
git config vcsh.vcsh 'true' git config vcsh.vcsh 'true'
use use
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment