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:
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