From 34bb501be08aa2b313d88e67d6e0a7e0a3f9cfa6 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sun, 5 May 2024 00:07:30 +0200 Subject: New upstream version 1.47.90 --- contrib/scripts/code-style-git-post-commit-hook | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 contrib/scripts/code-style-git-post-commit-hook (limited to 'contrib/scripts/code-style-git-post-commit-hook') diff --git a/contrib/scripts/code-style-git-post-commit-hook b/contrib/scripts/code-style-git-post-commit-hook new file mode 100755 index 00000000..8d464842 --- /dev/null +++ b/contrib/scripts/code-style-git-post-commit-hook @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +DISABLED=${NM_HOOK_DISABLED:0} + +if [ "$DISABLED" == 1 ]; then + echo "COMMIT HOOK DISABLED" + exit 0 +fi + +FORMATTER=contrib/scripts/nm-code-format.sh + +# Filter only C source files +CHANGED_FILES=$(git log --pretty='' --name-only -n1 | grep -E '\.c$|\.h$' | tr '\n' ' ') + +echo $CHANGED_FILES + +if [ -x "$FORMATTER" ] && [ ! -z "$CHANGED_FILES" ]; then + "$FORMATTER" -n "${CHANGED_FILES}" +fi -- cgit 1.3.0-6-gf8a5