Don Marti
2014-01-28 20:11:47 UTC
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...
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
***@zgp.org
See you at SCaLE: 21-23 Feb. 2014, Los Angeles: socallinuxexpo.org
Don Marti +1-510-332-1587 (mobile)
http://zgp.org/~dmarti/ Alameda, California, USA
***@zgp.org
See you at SCaLE: 21-23 Feb. 2014, Los Angeles: socallinuxexpo.org