Skip to content

Commit 54a9ae9

Browse files
Merge pull request #456 from CodeEditorLand/fix/scm-duplicate-groups-resolve-configuration
fix(scm): avoid setting both folderUri and workspace in ResolveConfiguration
2 parents 8268a85 + 9ec2051 commit 54a9ae9

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

Source/Function/Install/Function/ResolveConfiguration.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ export async function ResolveConfiguration(): Promise<ISandboxConfiguration> {
161161
}
162162
}
163163

164+
// True when running inside a Tauri webview (Mountain desktop shell).
165+
// DesktopMain reads `workspace` (ISingleFolderWorkspaceIdentifier).
166+
// The browser workbench reads `folderUri`.
167+
// Setting both causes the workbench to register the same git repository
168+
// twice via two independent workspace resolution paths, which makes the
169+
// Git extension call registerSCMProvider twice and produces duplicate
170+
// SCM group rows in the Source Control view.
171+
const IsTauri = typeof ResolveInvoke() === "function";
172+
164173
try {
165174
if (typeof Invoke === "function") {
166175
Paths = await (
@@ -241,6 +250,8 @@ export async function ResolveConfiguration(): Promise<ISandboxConfiguration> {
241250

242251
DevLog("config", "workspace:", JSON.stringify(Workspace));
243252

253+
DevLog("config", "isTauri:", String(IsTauri));
254+
244255
// Mountain returns logsPath as a session-timestamped directory
245256
// (e.g., .../logs/20260410T105248) with window1/ already created.
246257
// Use it directly - no additional timestamp nesting needed.
@@ -560,11 +571,18 @@ export async function ResolveConfiguration(): Promise<ISandboxConfiguration> {
560571

561572
extensionsPath: `${Paths.userDataDir || "/tmp/.fiddee"}/extensions`,
562573

563-
// Workspace - set from ?folder= URL param
564-
// folderUri is used by the browser workbench; workspace by the Electron workbench.
565-
folderUri: FolderUri,
566-
567-
workspace: Workspace,
574+
// Workspace resolution: folderUri and workspace must be mutually exclusive.
575+
// Both being set causes the workbench to open the same git repository
576+
// twice via two independent workspace paths, producing duplicate SCM
577+
// provider registrations and duplicate group rows in the Source Control view.
578+
//
579+
// In Tauri/Mountain (desktop): DesktopMain.reviveIdentifier() reads
580+
// `workspace` (ISingleFolderWorkspaceIdentifier). Pass workspace only.
581+
// In browser (no Tauri): the browser workbench reads `folderUri`.
582+
// Pass folderUri only.
583+
folderUri: IsTauri ? undefined : FolderUri,
584+
585+
workspace: IsTauri ? Workspace : undefined,
568586

569587
backupPath: undefined,
570588

0 commit comments

Comments
 (0)