Detect worktrees outside search roots via git worktree list - #30
Merged
Conversation
Discovery recognised a branch's checkout only where the working-tree folder itself sat under a configured search root, so a worktree kept in a central directory, nested past the scan depth, or created inside the main clone went unseen. Fido then offered to *create* a new worktree, which git rejected with "'<branch>' is already used by worktree at …". DiscoverTargetsAsync now asks git itself — `git worktree list` — for each scanned clone's worktrees, matching on the reported branch, so any checkout of the branch is surfaced as an openable worktree/main-clone card wherever it lives on disk. The filesystem scan is still what reaches each clone; git is what enumerates its worktrees. Dedup by main path (per clone) and by full worktree path (across clones) keeps a worktree that is both under the search root and git-registered from appearing twice. Also make the selected working-tree path copyable: a copy button in the OPEN strip puts it on the clipboard (narrated in the flight log), and the ellipsised card/strip paths carry a full-path tooltip. Tests: a service-level test and an end-to-end test prove a worktree outside the search roots is offered to open (not recreated); a test covers the clipboard copy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MyhgL1kgHpvgYJQLvePuWy
The copy button lived in a horizontal StackPanel beside the path chip, with a fixed MaxWidth=380 on the chip. A horizontal StackPanel measures its children with infinite width, so the chip measured at a fixed 380px regardless of the column's real width — and as the window was resized toward its 560px minimum the chip plus button overflowed the star column and painted over the kind label on the right. Put the chip back directly in the star column (so it ellipsises to the width actually available and never overflows) and group the copy button with the kind label in the trailing Auto column. The button keeps its tooltip and flight-log confirmation; only its position changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MyhgL1kgHpvgYJQLvePuWy
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
This PR fixes discovery of git worktrees that exist outside configured search roots by querying git directly (
git worktree list) instead of relying solely on folder scanning. It also adds a UI feature to copy the selected working-tree path to the clipboard.Key Changes
Discovery Logic (
OpenerService.cs)Dictionary<string, string>withHashSet<string>for clone deduplication, since we now enumerate worktrees per clone rather than per scanned folderseenPathsdeduplication to prevent duplicate targets when the same worktree is discovered multiple timesgit worktree listto get authoritative worktree information, including those outside search roots (central directories, nested pastSearchDepth, or inside the main clone)UI Enhancements (
MainWindow.axamlandMainWindow.axaml.cs)CopySelectedPathAsync()method with error handling and flight log narrationTests
CopyPathTests.cswith end-to-end test for clipboard functionalityOpenerServiceTests.cstest verifying worktrees outside search roots are discoveredMultipleWorktreesTests.csregression test ensuring external worktrees are offered to open rather than triggering a "create new worktree" placement cardNotable Implementation Details
<branch>is already used by worktree at …" by detecting existing checkouts viagit worktree listPath.GetFullPath()for consistent comparison and displayhttps://claude.ai/code/session_01MyhgL1kgHpvgYJQLvePuWy