Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/strict-bashism-check
diff options
context:
space:
mode:
authorErich Eckner <erich.eckner.ext@bestsecret.com>2023-05-22 16:29:47 +0200
committerErich Eckner <erich.eckner.ext@bestsecret.com>2023-05-22 16:29:47 +0200
commit709590e525ff812f73c18f67496c068bd4da8659 (patch)
tree75f79e9be2b161d99fa19e646c733bceac2834eb /bin/strict-bashism-check
parent62f871fb25b70860364b0023745c0f31516e69d0 (diff)
bin/strict-bashism-check: only check, what was changed
Diffstat (limited to 'bin/strict-bashism-check')
-rwxr-xr-xbin/strict-bashism-check13
1 files changed, 12 insertions, 1 deletions
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