diff options
author | Thomas Haller <thaller@redhat.com> | 2020-02-21 07:40:10 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-02-21 07:40:10 +0100 |
commit | 1bc5a7c778a86d359e9ef1427f051d64d6e09a9d (patch) | |
tree | fa3d338645a0529a184c38679acda21175726e2c | |
parent | 2b0689b9aea62b8ab910597b0cd581b34053e9cf (diff) | |
download | NetworkManager-1bc5a7c778a86d359e9ef1427f051d64d6e09a9d.tar.gz |
contrib/scripts: add "checkpatch-git-post-commit-hook" script to contrib/
This can be used as git post-commit hook.
-rwxr-xr-x | contrib/scripts/checkpatch-git-post-commit-hook | 23 |
1 files changed, 23 insertions, 0 deletions
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 |