From 1bc5a7c778a86d359e9ef1427f051d64d6e09a9d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 21 Feb 2020 07:40:10 +0100 Subject: [PATCH] contrib/scripts: add "checkpatch-git-post-commit-hook" script to contrib/ This can be used as git post-commit hook. --- .../scripts/checkpatch-git-post-commit-hook | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 contrib/scripts/checkpatch-git-post-commit-hook diff --git a/contrib/scripts/checkpatch-git-post-commit-hook b/contrib/scripts/checkpatch-git-post-commit-hook new file mode 100755 index 0000000000..964791077c --- /dev/null +++ b/contrib/scripts/checkpatch-git-post-commit-hook @@ -0,0 +1,23 @@ +#!/bin/sh + +# contrib/scripts/checkpatch-git-post-commit-hook: +# Call this script via ".git/hooks/post-commit" + +DISABLED=${NM_HOOK_DISABLED:0} + +if [ "$DISABLED" == 1 ]; then + echo "COMMIT HOOK DISABLED" + exit 0 +fi + +FILE=contrib/scripts/checkpatch-feature-branch.sh +if [ -x "$FILE" ]; then + "$FILE" + exit 0 +fi + +FILE=contrib/scripts/checkpatch.pl +if [ -x "$FILE" ]; then + git format-patch -U65535 --stdout -1 | "$FILE" + exit 0 +fi