Repository navigation
Use worktree-specific Git index paths - #2113
Merged
Tyrie Vella (tyrielv) merged 7 commits intoOct 28, 2026
Merged
Conversation
Route index generation, repair, FastFetch, and dehydrate backups through GitIndexPath. Reject full dehydrate for linked worktrees before it moves the .git file. Assisted-by: GPT-5.6 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Reject full dehydrate when linked worktrees exist. Store worktree backups beside each worktree with unique paths. Preserve backup errors and add regression coverage. Assisted-by: GPT-5.6 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Tyrie Vella (tyrielv)
enabled auto-merge
September 23, 2026 21:53
Nathan Baird (ShiningMassXAcc)
left a comment
Member
There was a problem hiding this comment.
Review pass over this PR. 7 comment(s).
Block full dehydrate when worktree registration reads fail. List the registered paths and explain stale-registration cleanup. Preserve per-file backup errors and trace the resolved index destination. Add a real-worktree dehydrate test and unit coverage for guard failures, trace metadata, and sub-second backup paths. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Keep backups outside worktrees when paths include a trailing separator. Resolve relative worktree registrations and retain full exceptions in diagnostic logs. Report both index backup paths and return a failed dehydrate exit code after backup errors. Add CLI tests for full-dehydrate guards, backup failures, and trailing separators. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Match Git by ignoring directories that contain no worktree registration. Continue to block full dehydrate when a present gitdir file is unreadable or malformed. Cover empty metadata entries alone and alongside a valid worktree registration. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Skip missing, zero-byte, and unreadable gitdir files. Record skipped read failures in diagnostic logs instead of blocking full dehydrate on entries Git does not list. Keep nonempty malformed registrations and enumeration errors blocking. Test whitespace-only content and mixed readable and unreadable registrations. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Reject unreadable reverse gitdir pointers. Ignore missing or empty pointers only when the administrative entry contains no other metadata. Keep nondestructive discovery unchanged. Add real-worktree tests that demonstrate Git omitting usable worktrees and verify full dehydrate stops before index mutation. Assisted-by: GPT-6.1 Sol Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Nathan Baird (ShiningMassXAcc)
approved these changes
Oct 28, 2026
Nathan Baird (ShiningMassXAcc)
left a comment
Member
There was a problem hiding this comment.
Re-reviewed the registration-guard fixes and their regression cases. No new correctness issues found in the delta.
Medium (nonblocking): The new missing, empty, and unreadable-registration functional cases pass, and the guard now fails closed. I could not find a changed-line coverage report for this delta. Please link one if available, or record the unavailable differential coverage in the PR validation notes. This is nonblocking.
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.
Problem and Context
Linked worktrees store their index in a per-worktree Git directory.
DotGitRootpoints to shared Git state instead.Several index callers still used
DotGitRoot. A linked-worktree operation can therefore read, replace, repair, or back up the primary index.Full dehydrate assumes that
.gitis a directory. It temporarily moves and restores the shared Git directory, which linked worktrees still need.Worktree backups used the primary enlistment root. Separate worktrees can select the same backup path or require a move across volumes.
Changes
GitIndexPathfor index generation, repair, FastFetch, and dehydrate backups.IndexPathandIsWorktreein the localCreateFromHeadTreeactivity trace.gitdirpointers are unreadable or malformed. Missing or empty pointers also block if other administrative metadata remains.gitdirfile. Keep nondestructive discovery unchanged.<worktree-parent>\dehydrate_backup\<worktree-name>\<timestamp>on the same volume. Trim trailing separators so backups stay outside the worktree.yyyyMMdd_HHmmsstoyyyyMMdd_HHmmss_fffffffto distinguish sub-second inputs.mock://repoURLs.The tests verify a byte-identical primary index and the correct worktree-index backup, including CLI paths with trailing separators.
Known gaps and deliberate decisions
git worktree listomits it.The destructive guard therefore blocks unverifiable metadata instead of using the listing as a safety signal.
Those mechanisms need separate changes. No follow-up PR is linked.