diff --git a/docs/commit-messages.md b/docs/commit-messages.md index 57047a803..b0d3e12e7 100644 --- a/docs/commit-messages.md +++ b/docs/commit-messages.md @@ -74,7 +74,7 @@ For the body (the rest of the description): - blank line after the subject (first) line - the text should be wrapped to ~76 characters (to appease git viewing tools, mainly), unless you really need longer lines (e.g. for ASCII art, tables, or long links) - there must be a `Fixes` or `Updates` line for all non-cleanup commits linking to a tracking bug. This goes after the body with a blank newline separating the two. A pull request may be referenced rather than a tracking bug (using the same format, e.g. `Updates #12345`), though a bug is generally preferred. [Cleanup commits](#is-it-a-cleanup) can use `Updates #cleanup` instead of an issue. -- `Change-Id` lines should be included in commits. You can configure Git to do this for you by running `./tool/go run misc/install-git-hooks.go` from the root of the repo. This was originally a Gerrit thing and we don't use Gerrit, but it lets tooling track commits as they're cherry-picked between branches. Also, tools like [git-cleanup](https://github.com/bradfitz/gitutil) use it to clean up your old local branches once they're merged upstream. +- `Change-Id` lines should be included in commits. You can configure Git to do this for you by running `./tool/go run misc/add-git-hooks.go` from the root of the repo. This was originally a Gerrit thing and we don't use Gerrit, but it lets tooling track commits as they're cherry-picked between branches. Also, tools like [git-cleanup](https://github.com/bradfitz/gitutil) use it to clean up your old local branches once they're merged upstream. - we don't use Markdown in commit messages. (Accidental Markdown like bulleted lists or even headings is fine, but not links) - we require `Signed-off-by` lines in public repos (such as `tailscale/tailscale`). Add them using `git commit --signoff` or `git commit -s` for short. You can use them in private repos but do not have to. - when moving code between repos, include the repository name, and git hash that it was moved from/to, so it is easier to trace history/blame. diff --git a/misc/install-git-hooks.go b/misc/add-git-hooks.go similarity index 74% rename from misc/install-git-hooks.go rename to misc/add-git-hooks.go index 813a45601..732816084 100644 --- a/misc/install-git-hooks.go +++ b/misc/add-git-hooks.go @@ -3,7 +3,7 @@ //go:build ignore -// The install-git-hooks program installs git hooks by delegating to +// The add-git-hooks program installs git hooks by delegating to // githook.Install. See that function's doc for what it does. package main @@ -16,6 +16,6 @@ func main() { log.SetFlags(0) if err := githook.Install(); err != nil { - log.Fatalf("install-git-hooks: %v", err) + log.Fatalf("add-git-hooks: %v", err) } } diff --git a/misc/git_hook/README.md b/misc/git_hook/README.md index 49d768937..67081b319 100644 --- a/misc/git_hook/README.md +++ b/misc/git_hook/README.md @@ -9,7 +9,7 @@ The shared logic lives in the `githook/` package and is also imported by From the repo root: - ./tool/go run ./misc/install-git-hooks.go + ./tool/go run ./misc/add-git-hooks.go The script auto-updates in the future. diff --git a/misc/git_hook/git-hook.go b/misc/git_hook/git-hook.go index 2cf3ff421..624c89f20 100644 --- a/misc/git_hook/git-hook.go +++ b/misc/git_hook/git-hook.go @@ -3,7 +3,7 @@ // The git-hook command is Tailscale's git hook binary, built and // installed under .git/hooks/ts-git-hook-bin by the launcher at -// .git/hooks/ts-git-hook. misc/install-git-hooks.go writes the initial +// .git/hooks/ts-git-hook. misc/add-git-hooks.go writes the initial // launcher; subsequent HOOK_VERSION bumps trigger self-rebuilds. // // # Adding your own hooks diff --git a/misc/git_hook/githook/install.go b/misc/git_hook/githook/install.go index 3c08daf8d..9c66e02c4 100644 --- a/misc/git_hook/githook/install.go +++ b/misc/git_hook/githook/install.go @@ -15,7 +15,7 @@ // Install writes the launcher to .git/hooks/ts-git-hook and runs it // once with "version", bootstrapping the binary build and per-hook -// wrappers. Called from each repo's misc/install-git-hooks.go. +// wrappers. Called from each repo's misc/add-git-hooks.go. func Install() error { hookDir, err := findHookDir() if err != nil { @@ -74,7 +74,7 @@ func WriteHooks(hooks []string) error { switch { case want[name] && !mine: return fmt.Errorf("%s exists and is not a ts-git-hook wrapper; "+ - "move your hook to %s.local (it will be chained after the wrapper) or delete it, then re-run: ./tool/go run ./misc/install-git-hooks.go", + "move your hook to %s.local (it will be chained after the wrapper) or delete it, then re-run: ./tool/go run ./misc/add-git-hooks.go", path, name) case !want[name] && mine: // Stale wrapper from a prior version (e.g. a hook we used diff --git a/misc/git_hook/githook/launcher.sh b/misc/git_hook/githook/launcher.sh index eddab585e..ba9f67dd9 100755 --- a/misc/git_hook/githook/launcher.sh +++ b/misc/git_hook/githook/launcher.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # ts-git-hook launcher (installed at .git/hooks/ts-git-hook). # -# Written by misc/install-git-hooks.go from the canonical copy embedded +# Written by misc/add-git-hooks.go from the canonical copy embedded # in tailscale.com/misc/git_hook/githook. On every invocation it: # # 1. Compares the binary's reported version against the shared @@ -41,7 +41,7 @@ HAVE="$("$BINARY" version 2>/dev/null || echo none)" if [ "$WANT" != "$HAVE" ]; then echo "git-hook: rebuilding ts-git-hook-bin..." >&2 (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/add-git-hooks.go" >&2 exit 1 } "$BINARY" install