Skip to content

Commit 40306c6

Browse files
committed
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
1 parent d0adbb2 commit 40306c6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

CodeEdit/WorkspaceView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ struct WorkspaceView: View {
8585
// MARK: - Source Control
8686

8787
.task {
88+
// Only refresh git data if source control is enabled
89+
guard sourceControlIsEnabled else { return }
90+
8891
do {
8992
try await sourceControlManager.refreshRemotes()
9093
try await sourceControlManager.refreshStashEntries()
@@ -95,7 +98,7 @@ struct WorkspaceView: View {
9598
)
9699
}
97100
}
98-
.onChange(of: sourceControlIsEnabled) { newValue in
101+
.onChange(of: sourceControlIsEnabled) { _, newValue in
99102
if newValue {
100103
Task {
101104
await sourceControlManager.refreshCurrentBranch()

0 commit comments

Comments
 (0)