Repository navigation
fix(workspace): report git hooks as live in a linked worktree - #1461
Merged
Merged
Conversation
This was referenced Aug 12, 2026
c-vigo
added a commit
that referenced
this pull request
Aug 12, 2026
…ling (#1471) ## Summary After #1463 (PR #1464), `just worktree-start` no longer unsets `core.hooksPath` — a configured hooks path is left untouched (the tracked `.githooks` shims cover the new worktree) and the prek install into the shared `.git/hooks` survives only as the fallback when no hooks path is set. The #1454 doctor comments in both `justfile` copies still asserted the old behavior was "the INTENDED state ... on purpose", which would actively mislead the next hook-state investigation (the #1430 → #1454 → #1461 → #1463 chain shows how much debugging here leans on these comments). ## Changes Comment-only, zero behavior delta: - `justfile` + `assets/workspace/justfile`: the doctor linked-worktree comment now describes post-#1463 reality — the shared-hooks PASS branch covers the no-hooksPath fallback plus worktrees created before #1463; a post-fix worktree keeps the shared setting and hits the normal `.githooks` PASS branch. The `--git-path` rationale and the copies' one-phrase wording difference are preserved. (These are independent copies — `scripts/manifest.toml` mirrors only `justfile.gh`/`justfile.worktree` — so both needed the hand edit.) - `tests/bats/doctor.bats`, `tests/bats/consumer-doctor.bats`, `tests/test_flake_hooks.py`: the same stale claim repeated in test comments, folded in per the scope note on the issue. Doctor logic and echo strings untouched; no changelog entry (internal docs). TDD skipped: comment-only, non-testable. ## Verification `bats tests/bats/doctor.bats tests/bats/consumer-doctor.bats` → 26/26 ok; full `prek run --all-files` → exit 0; clean tree. Closes #1469
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.
Description
Fixes #1454. Targets
release/1.8.0(post-recovery base9cce85ed).just doctorreportedWARN git hooks: … tracked but inertinside a linked worktree where the hooks are live, and the remediation it offered would have undone the worktree setup. A diagnostic that lies is the exact failure class #1430 exists to close.just worktree-startunsetscore.hooksPathon purpose — prek refuses to install its shims while it is set — and installs the shims instead.hooksis one of git's shared paths, so they land in the common git dir and git runs them from inside the worktree. Bothdoctorrecipes read that intended state as the fresh-clone failure.Type of Change
fix-- Bug fixtest-- Adding or updating testsModifiers
!) -- This change breaks backward compatibilityChanges Made
justfile-- devkit'sdoctor: linked-worktree PASS branch ahead of the fresh-clone WARN.assets/workspace/justfile-- the scaffoldeddoctor: identical branch, inserted after the mode-awarehintconstruction so [FEATURE] Ship a doctor recipe on the consumer surface (host preflight for scaffolded repos) #1448's hints are untouched.tests/bats/doctor.bats-- 3 tests + hermetic_git_fixture/_init_linked_worktreehelpers (realgit worktree addunderBATS_TEST_TMPDIR, pinned identity, signing off).tests/bats/consumer-doctor.bats-- 3 tests +_run_doctor_at/_scaffold_linked_worktree(commits the fixture so the linked checkout really carriesjustfile,.githooks,.vig-os).CHANGELOG.md(+ hook-synced mirror) -- entry under the 1.8.0### Fixed.Two mechanics the obvious implementation gets wrong, both established empirically rather than assumed:
.gitis a file in a linked worktree, so a literal.git/hooks/pre-committest can never see the shim. This usesgit rev-parse --git-path hooks/pre-commit— the file git itself would run.git rev-parse --absolute-git-dirvs--path-format=absolute --git-common-diris the safe comparison. A plain--git-dir/--git-common-dircompare falsely reports "linked" from a subdirectory of the main worktree (/abs/.gitvs../.git). This is also the idiomflake.nix'sgithooksPathHookalready uses.The PASS additionally requires the shim to be executable (
-x), since git ignores a non-executable hook.Verdict matrix
core.hooksPathhooks/pre-commit.githookscore.hooksPath -> .githooks.githookslinked worktree, installed at <path> (core.hooksPath unset by design)-n "$gitdir"guard keeps it out of the PASS branch)Changelog Entry
Placed in
## [1.8.0] - TBD, matching every post-freeze entry on this branch.Testing
Manual Testing Details
Real clone +
git worktree add+ the exactworktree-startsetup (unset-all core.hooksPath,prek install):BEFORE:
AFTER:
AFTER, same worktree with the shims deleted (must-stay-WARN case):
The verdicts are grounded in behavior, not inference: in the live worktree
git commit -m "bad message"was rejected byvalidate-commit-msg; after deleting the shims the same commit landed unblocked, confirming the WARN is true in that state.bats tests/bats/doctor.bats tests/bats/consumer-doctor.bats-> exit 1, exactly 2 failures (not ok 6,not ok 23), both showing the lying WARN. The other 4 new tests passed as intended — they pin cells that must not move.release/1.8.0: 502 ok, 0 not ok, exit 0.prek run --all-files-> exit 0, tree clean.test_manifest_files, verified pre-existing two ways (branch-point changelog sha already differs from the image's baked copy; re-ran with the pristine changelog checked out and it still failed).Checklist
CHANGELOG.md(and pasted the entry above)Additional Notes
Drift guard intact. #1448's
consumer doctor checks exactly what devkit's doctor checkspasses — the new PASS keeps thegit hookslabel, so both label sets stay identical. All mode-aware hint tests pass, andrefute_output --partial "scripts/init.sh"was added to both new consumer tests.Deliberately unchanged: main worktree + unset
core.hooksPath+ a prek shim in.git/hooksstill WARNs. The gates are live there too, so the WARN is under-informative — but it is literally true (.githooksis inert) and its remediation is harmless. #1454 explicitly says to keep the fresh-clone WARN for every other unset case, so that cell was left alone and not pinned either way. Worth a follow-up ifdoctorshould key purely off "what will git execute".Separate bug found, not fixed here:
git config --unset-all core.hooksPathinside a linked worktree writes to the shared config, sojust worktree-startsilently unsetscore.hooksPathfor the main checkout too, leaving its.githooksinert until something re-sets it. Reproduced. Deserves its own issue — anddoctorwill now correctly WARN about it.The base merge resolved one additive
CHANGELOG.mdconflict by keeping both this entry and the restored #1447 entry (#1459 recovery); the 1.8.0 section was re-audited afterwards and all entries carry their title bullets.Closes #1454
Refs: #1454