From 709590e525ff812f73c18f67496c068bd4da8659 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 22 May 2023 16:29:47 +0200 Subject: bin/strict-bashism-check: only check, what was changed --- bin/strict-bashism-check | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'bin/strict-bashism-check') diff --git a/bin/strict-bashism-check b/bin/strict-bashism-check index 8e58e05..b5a8eb6 100755 --- a/bin/strict-bashism-check +++ b/bin/strict-bashism-check @@ -8,6 +8,11 @@ else against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi +check_files=$( + git diff --cached --name-status "${against}" \ + | cut -f2 +) + # If you want to allow non-ASCII filenames set this variable to true. allownonascii=$(git config --bool hooks.allownonascii) @@ -93,7 +98,13 @@ if command -v shellcheck >/dev/null 2>&1; then -not -name 'opcode' \ -not -name 'opcode_list' \ -not -name '.*' \ - -execdir shellcheck -x '{}' \; 2>&1 + | grep -xF "${check_files}" \ + | while read -r file; do + ( + cd "${file%/*}" || exit $? + shellcheck -x "${file##*/}" 2>&1 + ) + done ) if [ -n "${errors}" ]; then -- cgit v1.2.3-54-g00ecf