Skip to content

Commit 7ba80da

Browse files
committed
Make check-mode.sh usable on macOS
The version of `bash` on macOS is old and doed not have `lastpipe`. This uses process substitution instead. This also fixes a couple of bugs in the CI job: - Change the name of the CI job to be the same as the script basename and `justfile` recipe. (I'm not sure if `check-mode` or `check-modes` is better, but it should be the same for all.) - Add the job as a dependency of `tests-pass`. (Otherwise it will fail `check-blocking` if not explicitly listed as not being required for PR auto-merge. Since the problems it finds are usually easy to fix correctly, it should probably not be exempt.)
1 parent bcf17d8 commit 7ba80da

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ jobs:
359359
- name: gix-pack with all features (including wasm)
360360
run: cd gix-pack && cargo build --all-features --target "$TARGET"
361361

362-
check-modes:
362+
check-mode:
363363
# FIXME: Only run this on ubuntu-latest (don't use a matrix).
364364
strategy:
365365
fail-fast: false
@@ -459,6 +459,7 @@ jobs:
459459
- test-32bit-cross
460460
- lint
461461
- cargo-deny
462+
- check-mode
462463
- check-packetline
463464
- check-blocking
464465

etc/check-mode.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22

33
set -eu -o pipefail
4-
shopt -s lastpipe
54

65
# Go to the worktree's root. (Even if the dir name ends in a newline.)
76
root_padded="$(git rev-parse --show-toplevel && echo -n .)"
@@ -29,13 +28,13 @@ function check () {
2928
status=1
3029
}
3130

32-
# For now, check just regular files named with a `.sh` suffix.
33-
git ls-files -sz -- '*.sh' | while read -rd '' mode oid _stage_number path; do
31+
# Check regular files named with a `.sh` suffix.
32+
while read -rd '' mode oid _stage_number path; do
3433
case "$mode" in
3534
100644 | 100755)
3635
check "$mode" "$oid" "$path"
3736
;;
3837
esac
39-
done
38+
done < <(git ls-files -sz -- '*.sh')
4039

4140
exit "$status"

0 commit comments

Comments
 (0)