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 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 the same one should be used for each.)
  • Loading branch information
EliahKagan committed Nov 28, 2024
1 parent bcf17d8 commit 00dc46e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 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
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 00dc46e

Please sign in to comment.