diff --git "a/\tb.sh" "b/\tb.sh" new file mode 100755 index 00000000000..e69de29bb2d diff --git a/ a.sh b/ a.sh new file mode 100644 index 00000000000..f1f641af19b --- /dev/null +++ b/ a.sh @@ -0,0 +1 @@ +#!/usr/bin/env bash diff --git a/etc/check-mode.sh b/etc/check-mode.sh index 4bc15b79ba5..44ac3bc4bbf 100755 --- a/etc/check-mode.sh +++ b/etc/check-mode.sh @@ -10,7 +10,7 @@ cd -- "$root" symbolic_shebang="$(printf '#!' | od -An -ta)" status=0 -function check () { +function check_item () { local mode="$1" oid="$2" path="$3" symbolic_magic # Extract the first two bytes (or less if shorter) and put in symbolic form. @@ -28,11 +28,18 @@ function check () { status=1 } +readonly record_pattern='^([0-7]+) ([[:xdigit:]]+) [[:digit:]]+'$'\t''(.+)$' + # Check regular files named with a `.sh` suffix. -while read -rd '' mode oid _stage_number path; do +while IFS= read -rd '' record; do + [[ $record =~ $record_pattern ]] + mode="${BASH_REMATCH[1]}" + oid="${BASH_REMATCH[2]}" + path="${BASH_REMATCH[3]}" + case "$mode" in 100644 | 100755) - check "$mode" "$oid" "$path" + check_item "${BASH_REMATCH[@]:1:3}" ;; esac done < <(git ls-files -sz -- '*.sh')