harness: fix guard detection failure on macOS bash 3.2
Replace mapfile (bash 4.0+) with bash 3.2-compatible while-read loop. macOS ships bash 3.2.57 (last GPLv2 version); mapfile silently failed, leaving STAGED array empty, so no security checks ran (conflict markers, secrets, private keys all missed). Guard self-test now passes 12/12. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,10 @@ if [ "${SKIP_HARNESS_GUARD:-0}" = "1" ]; then
|
||||
fi
|
||||
|
||||
ISSUES=0
|
||||
mapfile -t STAGED < <(git diff --cached --name-only --diff-filter=ACM 2>/dev/null)
|
||||
STAGED=()
|
||||
while IFS= read -r file; do
|
||||
STAGED+=("$file")
|
||||
done < <(git diff --cached --name-only --diff-filter=ACM 2>/dev/null)
|
||||
|
||||
for f in "${STAGED[@]}"; do
|
||||
[ -n "$f" ] || continue
|
||||
|
||||
Reference in New Issue
Block a user