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:
committed by
GitHub
parent
1e68a11721
commit
1669b0d3d4
@@ -1 +1 @@
|
|||||||
2
|
3
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ if [ "$WANT" != "$HAVE" ]; then
|
|||||||
GO="$REPO_ROOT/tool/go$EXE"
|
GO="$REPO_ROOT/tool/go$EXE"
|
||||||
if [ ! -x "$GO" ]; then GO=go; fi
|
if [ ! -x "$GO" ]; then GO=go; fi
|
||||||
echo "git-hook: rebuilding ts-git-hook-bin..." >&2
|
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
|
echo "git-hook: rebuild failed, run: ./tool/go run ./misc/install-git-hooks.go" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user