mirror of
https://github.com/tailscale/tailscale.git
synced 2026-09-12 22:08:26 -04:00
The pre-push large-blob check diffed the pushed tree only against the remote's old tree for the same ref. After rebasing a stale branch past an unrelated large-file change on the default branch, that diff shows the large file as changed even though the exact blob is already on the remote via main, rejecting the push with a false positive. Diff against every available base tree instead: the remote's old commit for the ref plus the merge base with the remote's default branch. Only flag a file that is a large addition relative to all bases, so blobs the remote already has are not reported, while genuinely new large files on the branch are still rejected. Updates tailscale/corp#9863 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: Ia0c98fc1f5ab67a2913f948aeff605c72641ada7
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/add-git-hooks.go
The script auto-updates in the future.
Large file check
The pre-push hook rejects pushes that add or change any blob over 1.5 MB, using the same tree diff logic as the check-file-size CI workflow. To push a large file intentionally, set an environment variable:
TS_SKIP_LARGE_FILE_CHECK=1 git push ...
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 undergithook/orgit-hook.go. Downstream repos pick it up after bumping theirtailscale.comdependency.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.