fix(hooks): keep the sync counter beside the git dir, not in the tree - #3392
Merged
Conversation
gHashTag
enabled auto-merge (squash)
September 6, 2026 18:03
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3391
.githooks/pre-commitincrements.trinity/notebook_commit_counton every commit, and that file was tracked. Every commit therefore dirtied the worktree, and git refused to move:Three refused checkouts and a refused merge in one day. Once it was worse than an inconvenience: the checkout meant to move onto a new branch failed, the edit that followed landed on the branch still checked out, and the pull request opened from there carried a neighbour session's changes as well — closed and rebuilt. The file has also reached 13 commits, every one a
git add -Athat swept it in.It is per-machine session state with exactly one reader in the whole repository: the hook itself.
Moved beside the git dir, where the hooks already live and nothing can reach a commit, plus
.gitignore.--git-common-dir, not--git-dir— worktrees share one repository, and "commits since the last sync" is a fact about the repository rather than about a checkout. Same placetri windowkeeps its measurement base, for the same reason.Control: after a commit the worktree is clean (
git status --porcelain→ 0 lines), the counter has incremented inside.git/, and a checkout and a merge immediately afterwards both succeed with nothing to restore first.