Skip to content

Commit ee33221

Browse files
authored
Merge pull request #1709 from EliahKagan/run-ci/mode-next
Fix `check-mode.sh` display of leading-whitespace paths
2 parents 34efe03 + 530948d commit ee33221

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

etc/check-mode.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cd -- "$root"
1010
symbolic_shebang="$(printf '#!' | od -An -ta)"
1111
status=0
1212

13-
function check () {
13+
function check_item () {
1414
local mode="$1" oid="$2" path="$3" symbolic_magic
1515

1616
# Extract the first two bytes (or less if shorter) and put in symbolic form.
@@ -28,11 +28,18 @@ function check () {
2828
status=1
2929
}
3030

31+
readonly record_pattern='^([0-7]+) ([[:xdigit:]]+) [[:digit:]]+'$'\t''(.+)$'
32+
3133
# Check regular files named with a `.sh` suffix.
32-
while read -rd '' mode oid _stage_number path; do
34+
while IFS= read -rd '' record; do
35+
[[ $record =~ $record_pattern ]] || exit 2 # bash 3.2 `set -e` doesn't cover this.
36+
mode="${BASH_REMATCH[1]}"
37+
oid="${BASH_REMATCH[2]}"
38+
path="${BASH_REMATCH[3]}"
39+
3340
case "$mode" in
3441
100644 | 100755)
35-
check "$mode" "$oid" "$path"
42+
check_item "$mode" "$oid" "$path"
3643
;;
3744
esac
3845
done < <(git ls-files -sz -- '*.sh')

0 commit comments

Comments
 (0)