Skip to content

Commit

Permalink
Make check-mode.sh usable on macOS
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
EliahKagan committed Nov 28, 2024
1 parent bcf17d8 commit 7ba80da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ jobs:
- name: gix-pack with all features (including wasm)
run: cd gix-pack && cargo build --all-features --target "$TARGET"

check-modes:
check-mode:
# FIXME: Only run this on ubuntu-latest (don't use a matrix).
strategy:
fail-fast: false
Expand Down Expand Up @@ -459,6 +459,7 @@ jobs:
- test-32bit-cross
- lint
- cargo-deny
- check-mode
- check-packetline
- check-blocking

Expand Down
7 changes: 3 additions & 4 deletions etc/check-mode.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

set -eu -o pipefail
shopt -s lastpipe

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

# For now, check just regular files named with a `.sh` suffix.
git ls-files -sz -- '*.sh' | while read -rd '' mode oid _stage_number path; do
# Check regular files named with a `.sh` suffix.
while read -rd '' mode oid _stage_number path; do
case "$mode" in
100644 | 100755)
check "$mode" "$oid" "$path"
;;
esac
done
done < <(git ls-files -sz -- '*.sh')

exit "$status"

0 comments on commit 7ba80da

Please sign in to comment.