summaryrefslogtreecommitdiffstats
path: root/pre-commit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:37:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:37:08 +0000
commitd710a65c8b50bc3d4d0920dc6e865296f42edd5e (patch)
treed3bf9843448af9398b55f49a50a194bbaacd724e /pre-commit
parentInitial commit. (diff)
downloadnghttp2-d710a65c8b50bc3d4d0920dc6e865296f42edd5e.tar.xz
nghttp2-d710a65c8b50bc3d4d0920dc6e865296f42edd5e.zip
Adding upstream version 1.59.0.upstream/1.59.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre-commit')
-rwxr-xr-xpre-commit27
1 files changed, 27 insertions, 0 deletions
diff --git a/pre-commit b/pre-commit
new file mode 100755
index 0000000..1dfe1f5
--- /dev/null
+++ b/pre-commit
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+
+CLANGFORMATDIFF=`git config --get clangformatdiff.binary`
+
+if [ -z "$CLANGFORMATDIFF" ]; then
+ CLANGFORMATDIFF=clang-format-diff.py
+fi
+
+errors=`git diff-index --cached --diff-filter=ACMR -p HEAD lib src examples tests | $CLANGFORMATDIFF -p1`
+
+if [ -n "$errors" ]; then
+ echo "$errors"
+ echo "--"
+ echo "[ERROR] We have detected the difference between the code to commit"
+ echo "and clang-format style rules. Please fix this problem in either:"
+ echo "1) Apply patch above."
+ echo "2) Use clang-format to format lines."
+ echo "3) Reformat these lines manually."
+ echo "Aborting commit."
+ exit 1
+fi