fix(hook-check): treat a Windows drive path as absolute (cygpath when present), so --list finds the skill hooks from a native caller

This commit is contained in:
garrytan committed 2026-10-08 16:43:28 +00:00
1 parent c0dc59d829
commit cb919cc770
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -51,7 +51,9 @@ if [ -z "$ROOT" ] || [ ! -d "$ROOT" ]; then
echo "usage: gstack-hook-check [--setup <file>] [--list] <gstack root>" >&2
exit 2
fi
case "$ROOT" in /*) ;; *) ROOT="$PWD/$ROOT" ;; esac
# A Windows path (D:\x or D:/x) from a native caller: use Git Bash's spelling.
case "$ROOT" in [A-Za-z]:[\\/]*) command -v cygpath >/dev/null 2>&1 && ROOT=$(cygpath -u "$ROOT") ;; esac
case "$ROOT" in /*|[A-Za-z]:[\\/]*) ;; *) ROOT="$PWD/$ROOT" ;; esac
[ "$ROOT" = / ] || ROOT=${ROOT%/}
SETUP_FILE="${SETUP_FILE:-$ROOT/setup}"
+3 -1
View File
@@ -81,7 +81,9 @@ function makeFixture(): Fixture {
' *) exit 64 ;;',
'esac',
]);
const hooks = spawnSync('bash', [path.join(root, 'bin/gstack-hook-check'), '--list', root], { encoding: 'utf8', timeout: 20_000 }).stdout.trim().split('\n');
const listed = spawnSync('bash', [path.join(root, 'bin/gstack-hook-check'), '--list', root], { encoding: 'utf8', timeout: 20_000 });
const hooks = listed.stdout.split('\n').map(line => line.trim()).filter(Boolean);
if (!hooks.includes('autoplan/bin/phase-publication-hook')) throw new Error(`gstack-hook-check --list missed the autoplan hook: ${listed.stdout}${listed.stderr}`);
for (const hook of hooks) write(path.join(root, hook), '#!/bin/sh\nexit 0\n', 0o755);
// The doctor launches each compiled binary's --version (#2595), so the
// stand-ins answer it like the real binaries do.