From 47a94c6d300965dbe5e3e73168326e9d88616dc0 Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Fri, 5 Jun 2026 19:14:26 -0400 Subject: [PATCH] git: Fix add safe directory button doing nothing (#58705) We had a nested spawn that was disguising the fact that the actual `git_config` task was being dropped immediately instead of detached. This only seems to cause problems in release builds due to timing issues. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed a bug where clicking the button to trust a git repository would do nothing. --- crates/git_ui/src/git_panel.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 93064b0e36fbc9..0cbf0cee9d230d 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -3174,7 +3174,7 @@ impl GitPanel { /// worktree to the `safe.directory` config, ensuring that, even if the user /// that's running the application is not the owner of `.git/`, it can still /// read the repository's contents. - fn add_safe_directory(&mut self, window: &mut Window, cx: &mut Context) { + fn add_safe_directory(&mut self, _window: &mut Window, cx: &mut Context) { let Some(active_repository) = &self.active_repository else { return; }; @@ -3192,12 +3192,10 @@ impl GitPanel { path_arg, ]; - cx.spawn_in(window, async move |git_panel, cx| { - git_panel.update(cx, |git_panel, cx| { - git_panel.project.read(cx).git_config(path, args, cx) - }) - }) - .detach(); + self.project + .read(cx) + .git_config(path, args, cx) + .detach_and_log_err(cx); } }