From 40306c65e8d6b2e9b3dd2097cb9aa59ed0ce788a Mon Sep 17 00:00:00 2001 From: vksvicky Date: Tue, 2 Dec 2025 10:08:11 +0000 Subject: [PATCH] Fix: Prevent git popup when Source Control is disabled (#2138) Fixed issue where CodeEdit would show "The 'git' command requires the command line developer tools. Would you like to install the tools now?" popup on every app launch, even when Source Control was completely disabled in Settings. Issue Analysis: - WorkspaceView.swift was unconditionally calling git operations (refreshRemotes and refreshStashEntries) on every workspace launch - These git commands triggered macOS to show the Command Line Developer Tools installation popup if git wasn't installed - The operations ran regardless of the sourceControlIsEnabled setting Solution: - Added guard statement to check sourceControlIsEnabled before running git operations in the .task block - Now git commands only execute when Source Control is enabled in Settings - Also updated onChange syntax to modern two-parameter form Result: - Users who disable Source Control no longer see the git tools popup - Git operations still work normally when Source Control is enabled - Popup behavior now respects user preferences as expected Fixes #2138 --- CodeEdit/WorkspaceView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CodeEdit/WorkspaceView.swift b/CodeEdit/WorkspaceView.swift index b52159d1ed..d28c15164e 100644 --- a/CodeEdit/WorkspaceView.swift +++ b/CodeEdit/WorkspaceView.swift @@ -85,6 +85,9 @@ struct WorkspaceView: View { // MARK: - Source Control .task { + // Only refresh git data if source control is enabled + guard sourceControlIsEnabled else { return } + do { try await sourceControlManager.refreshRemotes() try await sourceControlManager.refreshStashEntries() @@ -95,7 +98,7 @@ struct WorkspaceView: View { ) } } - .onChange(of: sourceControlIsEnabled) { newValue in + .onChange(of: sourceControlIsEnabled) { _, newValue in if newValue { Task { await sourceControlManager.refreshCurrentBranch()