From: Richard Hartmann Date: Tue, 20 Aug 2013 20:43:01 +0000 (+0200) Subject: vcsh: Implement pre-/post-init hooks X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/11138029488343b403050de89df6b6d396258a30?ds=sidebyside;hp=--cc vcsh: Implement pre-/post-init hooks --- 11138029488343b403050de89df6b6d396258a30 diff --git a/doc/hooks b/doc/hooks index 3c72ef8..54ff795 100644 --- a/doc/hooks +++ b/doc/hooks @@ -12,6 +12,8 @@ Available hooks are: * post-command * pre-enter * post-enter +* pre-init +* post-init * pre-pull * post-pull * pre-push diff --git a/doc/vcsh.1.ronn b/doc/vcsh.1.ronn index d5f0705..a198231 100644 --- a/doc/vcsh.1.ronn +++ b/doc/vcsh.1.ronn @@ -229,9 +229,12 @@ the repository's name, followed by a dot, i.e. . Otherwise, the same rules as above apply. The dot between the repository's name and the hook is mandatory, though. -Available hooks are , , , , -, and . If you need more, vcsh is trivial to patch, -but please let upstream know so we can ship them by default. +Available hooks are , , , +, , , , , +, , , , , , +, , and . +If you need more, vcsh is trivial to patch, but please let upstream know so +we can ship them by default. ## DETAILED HOWTO AND FURTHER READING diff --git a/vcsh b/vcsh index b962c2a..0822c9a 100755 --- a/vcsh +++ b/vcsh @@ -212,12 +212,14 @@ hook() { } init() { + hook pre-init [ ! -e "$GIT_DIR" ] || fatal "'$GIT_DIR' exists" 10 export GIT_WORK_TREE="$VCSH_BASE" mkdir -p "$GIT_WORK_TREE" || fatal "could not create '$GIT_WORK_TREE'" 50 cd "$GIT_WORK_TREE" || fatal "could not enter '$GIT_WORK_TREE'" 11 git init upgrade + hook post-init } list() {