]> git.madduck.net Git - code/vcsh.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

vcsh: Implement pre-/post-init hooks
authorRichard Hartmann <richih@debian.org>
Tue, 20 Aug 2013 20:43:01 +0000 (22:43 +0200)
committerRichard Hartmann <richih@debian.org>
Tue, 20 Aug 2013 20:43:01 +0000 (22:43 +0200)
doc/hooks
doc/vcsh.1.ronn
vcsh

index 3c72ef88e336f6eb8f109a6871aa7f2068eee469..54ff795611c0081e11eca8d16064f0f57f2ac60e 100644 (file)
--- a/doc/hooks
+++ b/doc/hooks
@@ -12,6 +12,8 @@ Available hooks are:
 * post-command
 * pre-enter
 * post-enter
 * post-command
 * pre-enter
 * post-enter
+* pre-init
+* post-init
 * pre-pull
 * post-pull
 * pre-push
 * pre-pull
 * post-pull
 * pre-push
index d5f070571d37e9aa3a7536e975a22c19b15fd541..a1982317097d01df21cc2dd4a3ce2d598cf4eb1a 100644 (file)
@@ -229,9 +229,12 @@ the repository's name, followed by a dot, i.e. <zsh.pre-run>. Otherwise, the
 same rules as above apply. The dot between the repository's name and the hook
 is mandatory, though.
 
 same rules as above apply. The dot between the repository's name and the hook
 is mandatory, though.
 
-Available hooks are <pre-enter>, <post-enter>, <pre-run>, <post-run>,
-<pre-upgrade>, and <post-upgrade>. If you need more, vcsh is trivial to patch,
-but please let upstream know so we can ship them by default.
+Available hooks are <pre-clone>, <post-clone>, <post-clone-retired>,
+<pre-command>, <post-command>, <pre-enter>, <post-enter>, <pre-init>,
+<post-init>, <pre-pull>, <post-pull>, <pre-push>, <post-push>, <pre-run>,
+<post-run>, <pre-upgrade>, and <post-upgrade>.
+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
 
 
 ## DETAILED HOWTO AND FURTHER READING
 
diff --git a/vcsh b/vcsh
index b962c2a575eedcaccb42ea434ed25b3552c30b30..0822c9ae10c2ac3f0caf4d02fefb3aaefae37505 100755 (executable)
--- a/vcsh
+++ b/vcsh
@@ -212,12 +212,14 @@ hook() {
 }
 
 init() {
 }
 
 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
        [ ! -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() {
 }
 
 list() {