Add a make-check check to pre-commit hook
authorJohan Dahlin <johan@gnome.org>
Mon, 29 Aug 2011 08:55:26 +0000 (05:55 -0300)
committerJohan Dahlin <jdahlin@litl.com>
Mon, 29 Aug 2011 08:55:26 +0000 (05:55 -0300)
Makefile.am
misc/pre-commit

index 7f8128523478779086fcf4aa5a147f8e1d016537..6d90ab512609927f77bf051669e1322c1b148807 100644 (file)
@@ -63,6 +63,7 @@ check-local:
        is not executable\n\nrun chmod +x .git/hooks/pre-commit"; false))
        @echo "  PEP-8 INQUISITION"
        @find $(top_srcdir)/giscanner -name \*.py | sort | uniq | xargs $(PYTHON) $(top_srcdir)/misc/pep8.py --repeat --exclude=config.py
+       @touch $(top_srcdir)/.make-check-passed
 
 check-pyflakes:
        @echo "  CHECK Pyflakes"
index b25dce6bbfa5e52108459b9a89b16def6963aec0..1f37d8667a441220d5bb8d7d8dc4b66c33d53cd2 100755 (executable)
@@ -68,3 +68,19 @@ perl -e '
     }
     exit($found_bad);
 '
+
+CHECK_FILE=.make-check-passed
+if ! test -f $CHECK_FILE; then
+    echo "You need to run make check before committing"
+    exit 1
+fi
+
+# Need to run make check at least once every 20 minutes
+MODIFIED=`stat -c %Y $CHECK_FILE`
+NOW=`date +%s`
+DELTA=$(($NOW-MODIFIED))
+if test "$DELTA" -ge "1200"; then
+    echo "You haven't ran make check in $((DELTA / 60)) minutes."
+    exit 1
+fi
+