File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ cd -- "$root"
10
10
symbolic_shebang=" $( printf ' #!' | od -An -ta) "
11
11
status=0
12
12
13
- function check () {
13
+ function check_item () {
14
14
local mode=" $1 " oid=" $2 " path=" $3 " symbolic_magic
15
15
16
16
# Extract the first two bytes (or less if shorter) and put in symbolic form.
@@ -28,11 +28,18 @@ function check () {
28
28
status=1
29
29
}
30
30
31
+ readonly record_pattern=' ^([0-7]+) ([[:xdigit:]]+) [[:digit:]]+' $' \t ' ' (.+)$'
32
+
31
33
# 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
+
33
40
case " $mode " in
34
41
100644 | 100755)
35
- check " $mode " " $oid " " $path "
42
+ check_item " $mode " " $oid " " $path "
36
43
;;
37
44
esac
38
45
done < <( git ls-files -sz -- ' *.sh' )
You can’t perform that action at this time.
0 commit comments