From 270e47cc79b3b6dd878e2dc346beacb0c6cc6146 Mon Sep 17 00:00:00 2001 From: Kiran_Peraka <71807617+Rogue-striker@users.noreply.github.com> Date: Sat, 8 Mar 2025 02:27:53 +0530 Subject: [PATCH] git: Fix errors not showing in the toast notification (#26303) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Release Notes: - Resolved an issue where error messages from Git were not being displayed in toast notifications. Screenshot 2025-03-08 at 1 11 30 AM --- crates/git/src/repository.rs | 12 +++++++++--- crates/git_ui/src/git_panel.rs | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rs index e1732c63eec69a1ac016bf2da53706fc8805ca4b..0f9be1d1c5c9ddaa8e0d42b3a08f1fc68aee8763 100644 --- a/crates/git/src/repository.rs +++ b/crates/git/src/repository.rs @@ -690,7 +690,9 @@ impl GitRepository for RealGitRepository { PushOptions::Force => "--force-with-lease", })) .arg(remote_name) - .arg(format!("{}:{}", branch_name, branch_name)); + .arg(format!("{}:{}", branch_name, branch_name)) + .stdout(smol::process::Stdio::piped()) + .stderr(smol::process::Stdio::piped()); let git_process = command.spawn()?; run_remote_command(ask_pass, git_process) @@ -712,7 +714,9 @@ impl GitRepository for RealGitRepository { .current_dir(&working_directory) .args(["pull"]) .arg(remote_name) - .arg(branch_name); + .arg(branch_name) + .stdout(smol::process::Stdio::piped()) + .stderr(smol::process::Stdio::piped()); let git_process = command.spawn()?; run_remote_command(ask_pass, git_process) @@ -727,7 +731,9 @@ impl GitRepository for RealGitRepository { .env("SSH_ASKPASS", ask_pass.script_path()) .env("SSH_ASKPASS_REQUIRE", "force") .current_dir(&working_directory) - .args(["fetch", "--all"]); + .args(["fetch", "--all"]) + .stdout(smol::process::Stdio::piped()) + .stderr(smol::process::Stdio::piped()); let git_process = command.spawn()?; run_remote_command(ask_pass, git_process) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 6f17f05d6367b24fb51040bc484c2607b64c3581..098bb0e902b941ad72d91d9a6c1ca1d8ae5b2a01 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -1571,6 +1571,7 @@ impl GitPanel { this.show_remote_output(RemoteAction::Fetch, remote_message, cx); } Err(e) => { + log::error!("Error while fetching {:?}", e); this.show_err_toast(e, cx); } } @@ -1629,7 +1630,10 @@ impl GitPanel { Ok(remote_message) => { this.show_remote_output(RemoteAction::Pull, remote_message, cx) } - Err(err) => this.show_err_toast(err, cx), + Err(err) => { + log::error!("Error while pull {:?}", err); + this.show_err_toast(err, cx) + } }) .ok(); @@ -1697,6 +1701,7 @@ impl GitPanel { this.show_remote_output(RemoteAction::Push(remote), remote_message, cx); } Err(e) => { + log::error!("Error while pushing {:?}", e); this.show_err_toast(e, cx); } })?;