You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d6ccca9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(test): skip prepush rows on bash without assoc arrays
The prepush focus note rows drive the hook through run-with-bash-5.sh, which refuses on macOS /bin/bash 3.2, so they now skip on HOOK_BASH_FOUND like the decision rows.
The hard-stop hook rows run run-all-checks.sh on plain bash, which stops at its declare -A line on bash 3.2, so they skip on a bash without associative arrays and a row asserts that refusal.
// Whether GIT_BASH has associative arrays, which run-all-checks.sh declares at its top (`declare -A`): macOS ships bash 3.2, where the hook stops on that line. Windows names Git Bash directly.
103
+
constHOOK_BASH_HAS_ASSOC=process.platform==='win32'||spawnSync(GIT_BASH,['-c','declare -A probe'],{encoding: 'utf8'}).status===0
// How long after the hook's exit the cleanup process may keep ending legs, read from the script so a change to the constant cannot pass unnoticed.
@@ -250,7 +252,16 @@ afterAll(() => {
250
252
251
253
// The hook's own stop path, run for real: a temp copy of .lefthook-scripts and scripts, with the four leg scripts replaced by stubs that sleep for a set time and record their pid. The seam is the copy; nothing in the hook is stubbed but the legs.
252
254
describe('the hard stop ends the legs of a real hook run',()=>{
// Only where GIT_BASH is older than 4.0: the rows below are skipped there, and this row pins the reason (the hook's `declare -A` is refused). CAPTURE: the `invalid option` text is from the macOS CI log of run 43028369623, job 130548734108.
259
+
it.skipIf(HOOK_BASH_HAS_ASSOC)('the bash on this host has no associative arrays, which the hook declares at its top',()=>{
260
+
constr=spawnSync(GIT_BASH,['-c','declare -A probe'],{encoding: 'utf8'})
// The stop fires as an event, not on the clock. The hook's start-up and planning are about 25 process starts before the first leg, 0.1 s each on a quiet host and 2 to 3 s each on this loaded Windows one (a stop timed against that start-up fired before any leg began, 2026-10-27), so a stub leg ends the watchdog by TERM once it has started: the watchdog's own TERM trap exits it, which wait_legs reads as the stop. HOOK_STOP_S is only the watchdog's own deadline, set past anything a row reaches.
0 commit comments