Conversation
…oups Two bugs when adding a repo via 'Existing folder': 1. AddRepositoryFromLocalAsync was cloning from the remote URL over the network instead of the local path. Added localCloneSource parameter to AddRepositoryAsync that clones from the local path and then sets remote.origin.url to the real remote URL. 2. ReconcileOrganization was creating a duplicate URL-based repo group even when a local folder group already existed for the same repo. Added a check to prefer existing local folder groups before calling GetOrCreateRepoGroup. Fixes: MAUI.Sherpa added as existing repo still cloned and showed duplicate entries (folder + repo) in sidebar treeview. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Multi-Model Code Review — PR #5333 independent reviewers analyzed this PR. Findings below reflect adversarial consensus (2+ reviewers must agree for inclusion). CI StatusOriginal Findings (Round 1)🟡 MODERATE — Second
|
…a-seems-i-added-mauishe-20260407-1614
- Apply local-folder-group-first check to the second ReconcileOrganization block (WorktreeId-based re-link) to prevent duplicate sidebar groups via the group-deletion healing path - Replace source-file-reading tests with behavioral integration tests that create real git repos and verify local clone + remote URL wiring - Add test for the second reconcile block scenario - Add defensive validation for localCloneSource in internal overload - Add comment documenting intentional no-fetch design choice - Remove unused AddDummySessions helper - Fix unnecessary string interpolation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… leak - Restore conditional changed=true in second reconcile block (only set when a group assignment actually happens, matching original behavior) - Make AddRepositoryAsync_LocalCloneSource_InvalidPath_Throws async instead of using .Result on the ThrowsAsync task - Add using to Process in RunGitOutput to prevent handle leaks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace AddRepositoryFromLocal_ClonesLocallyAndSetsRemoteUrl with AddRepositoryFromLocal_PointsBareClonePathAtLocalRepo (verifies BareClonePath points at user's local repo, no bare clone created) - Replace localCloneSource reflection test with source-code assertion that AddRepositoryFromLocalAsync never calls AddRepositoryAsync - Remove unused localCloneSource overload from AddRepositoryAsync - Add GetRepoRoot/ExtractMethodBody test helpers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Bug Report
[Session: MAUI.Sherpa] Adding MAUI.Sherpa as existing repository still cloned it from the network, and created duplicate entries (both a folder and a repo) in the sidebar treeview.
Root Cause
Two bugs in the 'Add Existing Folder' flow:
Bug 1: Network clone for local repos
\AddRepositoryFromLocalAsync\ extracted the remote URL from the local repo's \origin\ remote, then called \AddRepositoryAsync(remoteUrl)\ which does \git clone --bare \ from the network — even though the local repo is right there.
Fix: Added \localCloneSource\ parameter to \AddRepositoryAsync\ that clones from the local path and then sets
emote.origin.url\ to the real remote URL (so future fetches still go to the network).
Bug 2: Duplicate sidebar groups
\ReconcileOrganization\ auto-creates URL-based repo groups when it links sessions to worktrees. But \GetOrCreateRepoGroup\ explicitly skips \IsLocalFolder\ groups, so it created a second group even when a local folder group already existed.
Fix: Before calling \GetOrCreateRepoGroup, check if a local folder group with the same \RepoId\ exists and use it instead.
Testing