Open
Conversation
Git 2.52 refuses to auto-discover from a linked worktree when the bare common dir has core.bare=true and extensions.worktreeConfig=true unless each worktree's config.worktree explicitly sets core.bare=false. wt's layout hits this exactly, so every git command from inside a worktree fails (e.g. "git status"). - Enable extensions.worktreeConfig on the bare repo during wt clone, and cache the call on Runner so it isn't re-forked on every wt add. - Write core.bare=false into each worktree's config.worktree after every WorktreeAdd / WorktreeAddNew. - Add wt repair as an idempotent migration for projects cloned before this fix: enables the extension and back-fills config.worktree on every linked worktree that lacks the override. - Cover the regression in TestIntegrationCloneAndWorktree (git status from inside the worktree must succeed) and add unit tests for the config parser and gitdir-pointer resolution.
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.
Summary
core.bare=trueandextensions.worktreeConfig=true, every linked worktree must overridecore.bare=falsein its ownconfig.worktree. Without it,git status(and everything that auto-discovers) fails from inside a worktree.wt clonenow enablesextensions.worktreeConfigonce, andWorktreeAdd/WorktreeAddNewwritecore.bare=falseinto each new worktree'sconfig.worktree(with the extension call cached perRunnerso we don't re-fork).wt repaircommand back-fills the extension and per-worktree override on projects cloned before this fix. Idempotent.Test plan
make dev(fmt, lint, full test suite, build) cleanTestIntegrationCloneAndWorktreeextended to assertextensions.worktreeConfig=trueon the bare config,core.bare=falsein the worktree'sconfig.worktree, and thatgit statussucceeds from inside the worktreeTestHasBareFalsecovers the tolerant config parserTestWorktreeConfigPath_LinkedWorktreeresolves a real.gitpointer file against a real bare repo + linked worktree./wt repairagainst an existing project on git 2.52+ and confirmgit statusworks in each worktree afterward; second run reports0 repaired