From f57dece2d567fea67722bde10de7643ddbbaa313 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 4b3d223fc702ca37eac421dc568bb6d29b6198aa..732a0d4d1e0fdeb4482847ab5d0aa650e1f8513a 100644 --- a/crates/git/src/repository.rs +++ b/crates/git/src/repository.rs @@ -692,7 +692,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) @@ -714,7 +716,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) @@ -729,7 +733,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 eb0f22294d011980622d7829b908f1b8e849fb9b..8954949cbcda02e65515f45e0a0427ed9b798585 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); } })?;