Don Marti

Wed 20 Apr 2011 05:10:00 PM PDT

git with multiple post-receive hooks

Having fun with hooking up a "central" shared git repository to other tools, which had been hooked up to a Subversion repository. (hey, kids! hack for track-git-plugin to make the old Subversion revision links keep working).

Anyway, the git "post-receive-hook" interface is a little tweakier than the Subversion "post-commit" one. The hook gets its input on stdin, not via the command-line arguments as the Subversion hook does. But I have to run multiple tools, each of which has its own post-receive-hook script, and I don't want to mash up the scripts.

So far the simplest way I have found to handle this is to put something like this in .git/hooks/post-receive:

    pee $GIT_DIR/hooks/tool-hook-*

(pee is from moreutils.) Runs all the tool hooks each with its own copy of the same stdin. Works so far.

You can do something similar with a temporary file, but it's more lines.

thank you!
Comment by Anonymous Tue 03 Jan 2012 02:38:24 PM PST