From 680674c3077b77f784d7bd90a4bdfcb96694bbf1 Mon Sep 17 00:00:00 2001 From: Edbert Chan <1916223+EdbertChan@users.noreply.github.com> Date: Mon, 12 Oct 2026 21:38:47 -0700 Subject: [PATCH] Make the pre-push check run on the shell macOS ships The pre-push review-unit check used a bash 4 builtin that the default macOS shell (3.2) does not have, so every push from a Mac stopped at the hook. Read the NUL-separated file lists with a portable loop instead. Co-Authored-By: Claude Sonnet 5.5 Change-Id: I186973c821653410e5d48a13d1acd2f2e4bb8433 --- scripts/git-hooks/pre-push | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/git-hooks/pre-push b/scripts/git-hooks/pre-push index 61b583dae..34516a867 100755 --- a/scripts/git-hooks/pre-push +++ b/scripts/git-hooks/pre-push @@ -157,7 +157,7 @@ while read -r local_ref local_sha remote_ref remote_sha; do echo "pre-push: UNCHECKED: git diff $diff_from $local_sha failed for $local_ref; $bypass" >&2 exit 1 fi - mapfile -d '' files <"$names" + files=(); while IFS= read -r -d '' _path; do files+=("$_path"); done <"$names" if [[ ${#files[@]} -eq 0 ]]; then continue fi @@ -173,7 +173,7 @@ while read -r local_ref local_sha remote_ref remote_sha; do if old_diff_from=$(git merge-base "$base_ref" "$remote_sha" 2>/dev/null); then old_names=$(mktemp) if git diff --name-only -z "$old_diff_from" "$remote_sha" >"$old_names"; then - mapfile -d '' old_files <"$old_names" + old_files=(); while IFS= read -r -d '' _path; do old_files+=("$_path"); done <"$old_names" if [[ ${#old_files[@]} -eq 0 ]]; then old_rc=0 else @@ -182,7 +182,7 @@ while read -r local_ref local_sha remote_ref remote_sha; do if [[ $old_rc -eq 1 ]]; then delta_names=$(mktemp) if git diff --name-only -z "$remote_sha" "$local_sha" >"$delta_names"; then - mapfile -d '' delta_files <"$delta_names" + delta_files=(); while IFS= read -r -d '' _path; do delta_files+=("$_path"); done <"$delta_names" if [[ ${#delta_files[@]} -eq 0 ]]; then continue fi