You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Worktree mappings currently preserve project names only when each repository has its own explicit path-prefix row. That works for a few deleted worktrees, but it does not scale for layouts such as {repo}.worktrees/{branch} where the canonical project is already present in the path segment.
This adds a layout mode to the existing worktree mapping row instead of creating a separate template system. Existing rows stay explicit and keep their current behavior. A new {repo}.worktrees/{branch} layout lets one parent-directory mapping derive the project from service.worktrees style directories, while the existing longest-prefix precedence still lets a more specific explicit mapping override the generic layout.
The resolver stays in the worktree mapping layer, and the settings API and UI only adapt that row shape. Scope is limited to the local worktree mapping path; parser behavior, backend sync semantics, and unrelated project inference remain unchanged.
internal/db/worktree_mappings.go:417 - A repo_dot_worktrees mapping can shadow broader valid mappings even when the cwd is not inside a {repo}.worktrees/{branch} directory. bestWorktreeProjectMapping stops on the first path-prefix match, then resolveRepoDotWorktreesProject returns false, so resolution never falls through to a less-specific explicit mapping such as the supported root-prefix mapping.
Fix: Resolve mappings in order and continue to the next mapping when the selected layout cannot resolve for that cwd, or make the “best mapping” predicate layout-aware.
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
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.
Worktree mappings currently preserve project names only when each repository has its own explicit path-prefix row. That works for a few deleted worktrees, but it does not scale for layouts such as
{repo}.worktrees/{branch}where the canonical project is already present in the path segment.This adds a layout mode to the existing worktree mapping row instead of creating a separate template system. Existing rows stay explicit and keep their current behavior. A new
{repo}.worktrees/{branch}layout lets one parent-directory mapping derive the project fromservice.worktreesstyle directories, while the existing longest-prefix precedence still lets a more specific explicit mapping override the generic layout.The resolver stays in the worktree mapping layer, and the settings API and UI only adapt that row shape. Scope is limited to the local worktree mapping path; parser behavior, backend sync semantics, and unrelated project inference remain unchanged.
Fixes #582