Automatically install pre-commit hook
authorMartin Pitt <martinpitt@gnome.org>
Tue, 18 Dec 2012 08:35:02 +0000 (09:35 +0100)
committerMartin Pitt <martinpitt@gnome.org>
Tue, 18 Dec 2012 21:20:49 +0000 (22:20 +0100)
Instead of telling the user to do so and failing, we can just install the hook
ourselves. This saves the user some trouble and more importantly avoids
breaking tests in jhbuild continuous integration setups.

https://bugzilla.gnome.org/show_bug.cgi?id=686388

Makefile.am

index c4f6703..7016458 100644 (file)
@@ -58,10 +58,7 @@ EXTRA_DIST +=                        \
 
 check-local:
        gtester --verbose $(GTESTER_PROGS)
-       @test ! -d $(top_srcdir)/.git || (test -f $(top_srcdir)/.git/hooks/pre-commit || (echo -e "ERROR: missing \
-       pre-commit hook.\n\ncopy misc/pre-commit to .git/hooks"; false))
-       @test ! -d $(top_srcdir)/.git || (test -x $(top_srcdir)/.git/hooks/pre-commit || (echo -e "ERROR: pre-commit \
-       is not executable\n\nrun chmod +x .git/hooks/pre-commit"; false))
+       @test ! -d $(top_srcdir)/.git || (test -f $(top_srcdir)/.git/hooks/pre-commit || install misc/pre-commit .git/hooks/pre-commit)
        @echo "TEST: PEP-8 INQUISITION"
        @find $(top_srcdir)/giscanner -name \*.py | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pep8.py --repeat --exclude=config.py
        @echo "TEST: Annotation pattern programs"