[linux-elitists] Perhaps bonghits will fix my Git hooks

Don Marti dmarti at zgp.org
Tue Jan 28 12:11:47 PST 2014


I'm thinking about keeping my Git hooks the same on
all copies of a small repository.  Here's what I have
so far.

1. Move the actual content of the hook into the Makefile.
   (so that you can do "make pre-commit")

2. Rewrite the hook to just invoke make.

3. Add a "hooks" target to install the new simpler
   versions of the hooks.

So I get something like...

hooks : .git/hooks/pre-commit

.git/hooks/% : Makefile
	echo "#!/bin/sh" > $@
	echo "make `basename $@`" >> $@
	chmod 755 $@

pre-commit :
	git diff-index --check HEAD


Now is when I find out that this is a terrible idea,
and why...

-- 
Don Marti                                 +1-510-332-1587 (mobile)
http://zgp.org/~dmarti/                   Alameda, California, USA
dmarti at zgp.org
See you at SCaLE: 21-23 Feb. 2014, Los Angeles: socallinuxexpo.org


More information about the linux-elitists mailing list