misc/git_hook: fix building git_hook in a nested worktree (#19473)

When the repo is checked out as a nested worktree, a go.work in the
outer tree hijacks module resolution, which makes the rebuild fails
with "main module does not contain package." Set GOWORK=off for the
build since the hook is self-contained.

Bumps HOOK_VERSION so existing installs pick up the fix.

Updates #cleanup

Change-Id: Ibd14849efc26e4e1893c5b8e300caa71573f54bd

Signed-off-by: Fernando Serboncini <fserb@fserb.com.br>
This commit is contained in:
Fernando Serboncini 2026-04-21 11:42:53 -04:00 committed by GitHub
parent 1e68a11721
commit 1669b0d3d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -1 +1 @@
2
3

View File

@ -36,7 +36,7 @@ if [ "$WANT" != "$HAVE" ]; then
GO="$REPO_ROOT/tool/go$EXE"
if [ ! -x "$GO" ]; then GO=go; fi
echo "git-hook: rebuilding ts-git-hook-bin..." >&2
(cd "$REPO_ROOT" && "$GO" build -o "$BINARY" ./misc/git_hook) || {
(cd "$REPO_ROOT" && GOWORK=off "$GO" build -o "$BINARY" ./misc/git_hook) || {
echo "git-hook: rebuild failed, run: ./tool/go run ./misc/install-git-hooks.go" >&2
exit 1
}