File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ cd -- "$root"
1010symbolic_shebang=" $( printf ' #!' | od -An -ta) "
1111status=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
3845done < <( git ls-files -sz -- ' *.sh' )
You can’t perform that action at this time.
0 commit comments