X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/8b015a02474ffd228669a43aea715db87ebb5389..c189913f6c8eebaa6f2dcfcd666ccc4b17ec6c26:/vcsh?ds=inline diff --git a/vcsh b/vcsh index f7c565d..bf97cbf 100755 --- a/vcsh +++ b/vcsh @@ -1,7 +1,7 @@ #!/bin/sh # This program is licensed under the GNU GPL version 2 or later. -# (c) Richard "RichiH" Hartmann, 2011 +# (c) Richard "RichiH" Hartmann , 2011 # For details, see LICENSE. To submit patches, you have to agree to # license your code under the GNU GPL version 2 or later. @@ -11,6 +11,7 @@ [ -r "$XDG_CONFIG_HOME/vcsh/config" ] && . "$XDG_CONFIG_HOME/vcsh/config" [ -n "$VCSH_DEBUG" ] && set -vx [ -z "$VCSH_REPO_D" ] && VCSH_REPO_D="$XDG_CONFIG_HOME/vcsh/repo.d" +[ -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' @@ -103,14 +104,23 @@ To continue, type \"Yes, do as I say\"" } enter() { + hook pre-enter use $SHELL + hook post-enter } git_dir_exists() { [ -d "$GIT_DIR" ] || fatal "no repository found for '$VCSH_REPO_NAME'" 12 } +hook() { + for f in $VCSH_HOOK_D/$1* $VCSH_HOOK_D/$VCSH_REPO_NAME.$1*; do + [ -x "$f" ] || continue + "$f" + done +} + init() { [ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10 export GIT_WORK_TREE="$VCSH_BASE" @@ -150,8 +160,10 @@ rename() { } run() { + hook pre-run use $VCSH_EXTERNAL_COMMAND + hook post-run } setup() {