From e2649076c6e7249b705844e6d33047e812c5e2ea Mon Sep 17 00:00:00 2001 From: Tomas Susanka Date: Tue, 8 Jan 2019 17:22:43 +0100 Subject: [PATCH] docs: add git pre-push hook --- docs/git/hooks/pre-push | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/git/hooks/pre-push diff --git a/docs/git/hooks/pre-push b/docs/git/hooks/pre-push new file mode 100644 index 000000000..cd7a03d47 --- /dev/null +++ b/docs/git/hooks/pre-push @@ -0,0 +1,22 @@ +#!/bin/sh + +# Runs a simple check before pushing. In particular, this checks +# if templates were regenerated and style is correct. +# Put this file to `.git/hooks/`. + +echo "Running pre-push git hook." + +# Runs check for common simple errors before pushing +if ! make templates_check &> /dev/null +then + echo >&2 "Templates not updated, run 'make templates'. Not pushing." + exit 1 +fi + +if ! make style &> /dev/null +then + echo >&2 "Style invalid, run style make commands. Not pushing." + exit 2 +fi + +echo "pre-push hook passed. Pushing."