From ba4cb2a2cc930cb173ff6dbbdbcc93f7e62b5564 Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Wed, 29 Jul 2026 18:30:02 +0800 Subject: [PATCH] Trim trailing newline from git clone error messages (#61674) # Objective When `git clone` fails, the error message produced by git is collected, propagated, and finally displayed to the user in a pop-up. However, the pop-up always contains an extra blank line. The root cause is that Zed builds the error message using simple string concatenation: https://github.com/zed-industries/zed/blob/82aef44308540b576e4e51fb379efa71614e5c91/crates/fs/src/fs.rs#L1253-L1258 and the error message from `git clone` contains a trailing newline, which results in the blank line in Zed's error pop-up. ## Solution Trim the trailing whitespace from the error message produced by `git clone`. ## Testing Built and tested locally. The before/after comparison is shown below. ## 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 adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- ## Show Case | Before | After | | :--: | :--: | | Before | After | Release Notes: - Fixed extra blank line appearing in git clone error messages --- crates/fs/src/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index 009ac99acd..7fb443160b 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -1253,7 +1253,7 @@ impl Fs for RealFs { if !output.status.success() { anyhow::bail!( "git clone failed: {}", - String::from_utf8_lossy(&output.stderr) + String::from_utf8_lossy(&output.stderr).trim_end() ); }