From: Johannes Schindelin Date: Wed, 21 Jan 2009 21:10:46 GMT Subject: Re: What about allowing multiple hooks? Message-ID: In-Reply-To: <4977872E.70901@0x63.nu> 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]*.