Re: What about allowing multiple hooks?

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

 



Hi,

On Wed, 21 Jan 2009, Anders Waldenborg wrote:

> I need multiple hooks, so I've done some thinking about this, so I 
> thought it may be a good idea to share this here.
> 
> I currently use configvalues to specify which hooks to run. For example 
> this is how my post-receive looks:
> 
> data=$(cat)
> git config --get-all hooks.post-receive.hook | while read hook; do
>         $hook <<__EOF__
> "$data"
> __EOF__
> done

I wonder why you don't do the obvious thing:

	data=$(cat)
	for hook in .git/hooks/update.d/*
	do
		test -x "$hook" || continue
		echo "$data" | "$hook" | exit
	done

and then name the hooks in your .git/hooks/update.d/ with leading 
zero-padded numbers so that you guarantee a certain order.

You can even share special hooks between repositories by symlinking, as is 
done in /etc/init.d/rc?.d.

Hth,
Dscho

P.S.: If you want to save even more interactive work, you can name the 
hooks .git/hooks/update.[0-9]*.

--
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]

  Powered by Linux