Re: global hooks - once again

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano wrote:

> Now, as long as the "do once per repository" action that you need to do is
> simple enough, it doesn't necessarily have to be "git config".  Perhaps
> 
>     [alias]
>     set-hooks = !"sh -c 'rm -fr .git/hooks && ln -s $1 .git/hooks' -"

It is not difficult to set up hook scripts when initializing a
repository.  In fact git clone --template= and the “[init]
templatedir” configuration work pretty well.  What is more difficult
is to change the list of hook scripts later.

If I symlink the entire hooks dir like you describe, I cannot override
a couple of hooks per-repository without teaching the hook scripts to
handle that themselves.  (something like:

	hook=$(basename "$0")
	! test -e "$GIT_DIR/local-hooks/$hook.disable" || exit 0
	! test -e "$GIT_DIR/local-hooks/$hook" ||
		exec "$GIT_DIR/local-hooks/$hook"

)  Maybe that is the simplest solution.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]