branch: elpa/logview
commit 8ff518328fd064b15a67c6d92bbb17b89fa1419e
Author: Paul Pogonyshev <pogonys...@gmail.com>
Commit: Paul Pogonyshev <pogonys...@gmail.com>

    Add a simplistic but useful Git hook.
---
 githooks/pre-commit | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/githooks/pre-commit b/githooks/pre-commit
new file mode 100755
index 0000000000..3efc31e9e5
--- /dev/null
+++ b/githooks/pre-commit
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# This can be used in a comment as a reminder to self.
+git diff-index --cached -S "DONOTCOMMIT" HEAD --patch --exit-code ":!githooks" 
\
+    || { echo; echo "Have you forgotten about the “DONOTCOMMIT”?"; exit 1; }
+
+# Eldev functions can be used during development, but must not be committed.
+git diff-index --cached -S "eldev-" HEAD --patch --exit-code ":!githooks" 
":!Eldev" \
+    || { echo; echo "Don't commit code relying on Eldev!"; exit 1; }

Reply via email to