misc/git_hook: propagate shared HOOK_VERSION (#19476)

Move HOOK_VERSION into the githook package and export it as
githook.HookVersion, so tailscale/corp can reference it via
the shared-code bump instead of having to bump HOOK_VERSION
by hand.

New launcher.sh composes the wanted version from 2 sources:
the shared HOOK_VERSION and an optional repo local version,
misc/git_hook/HOOK_VERSION, for repo-specific config bumps.

Updates tailscale/corp#40381

Change-Id: I7cf16889ba53cb564cc2df7dfd7588748f542c55

Signed-off-by: Fernando Serboncini <fserb@tailscale.com>
This commit is contained in:
Fernando Serboncini
2026-05-04 12:38:28 -04:00
committed by GitHub
parent 290a6cc03c
commit 29122506be
5 changed files with 29 additions and 22 deletions
+9 -8
View File
@@ -22,13 +22,14 @@ script after a built-in hook. For example, put a custom check in
only if the built-in hook succeeds; failure aborts the git operation.
## Changing the shared code
## Version bumps
When you change anything under `githook/` or `launcher.sh`, bump
`HOOK_VERSION` in the same commit so every dev auto rebuilds on their next
git operation.
The launcher rebuilds when the installed binary's version differs from
the concatenation of two files:
Because `tailscale/corp` imports `githook/`, also plan the downstream
update: after landing here, bump corp's `tailscale.com` dependency and
bump corp's own `misc/git_hook/HOOK_VERSION` on a separate commit. Both are
required.
* `githook/HOOK_VERSION` (shared): bump when changing anything under
`githook/` or `git-hook.go`. Downstream repos pick it up after
bumping their `tailscale.com` dependency.
* `misc/git_hook/HOOK_VERSION` (repo-local, optional): bump to force a
rebuild for repo-specific config changes without touching the shared
version. This repo does not use one.