Fernando Serboncini 29122506be
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>
2026-05-04 12:38:28 -04:00
..

git_hook

Tailscale's git hooks.

The shared logic lives in the githook/ package and is also imported by tailscale/corp.

Install

From the repo root:

./tool/go run ./misc/install-git-hooks.go

The script auto-updates in the future.

Adding your own hooks

Create an executable .git/hooks/<hook-name>.local to chain a custom script after a built-in hook. For example, put a custom check in .git/hooks/pre-commit.local and chmod +x it. The local hook runs only if the built-in hook succeeds; failure aborts the git operation.

Version bumps

The launcher rebuilds when the installed binary's version differs from the concatenation of two files:

  • 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.