[vcsh] hook system for vcsh

Dieter Plaetinck dieter at plaetinck.be
Mon Jan 9 10:34:49 CET 2012


i like the concept and the general implementation looks compact and neat.

vdemeester wrote:
> Only the ones that have an executable bit will be sourced.
setting executable flag to make it become sourced seems weird.
especially because +x is not even needed if it's sourced.
i would say merely the fact that a file is stored within
$XDG_CONFIG_HOME/vcsh/hook.d/init/ qualifies it as a hook. nothing more
is needed. no +x flag.

RichiH wrote:
> What if you need to run a hook for zsh, only?
inside the hook file, you can do logic like:
if [ "$VCSH_REPO_NAME" = "vcsh" ]; then... fi
the fact that hooks are sourced (vs executed) is very powerful, it
gives the hook access to everything going on within vcsh. (all vars,
all defined functions, etc)

vdemeester wrote:
> For example if I want foo and bar hook for the init hook :
> With git hook approach, you would have to source foo and bar in the
> $VCSH_HOOK_D/init file.

what are foo and bar? different files, so the $VCSH_HOOK_D/init file sources those 2 files?

Dieter


More information about the vcs-home mailing list