Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Git Beta: Fix a few cases of empty toasts showing up (#25985)

Mikayla Maki74fc52d5cec8
diff --git a/crates/git_ui/src/remote_output_toast.rs b/crates/git_ui/src/remote_output_toast.rs
index c156dcc0e7f..dd00da080b3 100644
--- a/crates/git_ui/src/remote_output_toast.rs
+++ b/crates/git_ui/src/remote_output_toast.rs
@@ -71,7 +71,7 @@ impl RemoteOutputToast {
}
});
- let message;
+ let mut message: SharedString;
let remote;
match action {
@@ -86,19 +86,32 @@ impl RemoteOutputToast {
RemoteAction::Push(remote_ref) => {
message = output.stdout.trim().to_string().into();
- let remote_message = get_remote_lines(&output.stderr);
- let finder = LinkFinder::new();
- let links = finder
- .links(&remote_message)
- .filter(|link| *link.kind() == LinkKind::Url)
- .map(|link| link.start()..link.end())
- .collect_vec();
-
- remote = Some(InfoFromRemote {
- name: remote_ref.name,
- remote_text: remote_message.into(),
- links,
- });
+ if message.is_empty() {
+ message = output.stderr.trim().to_string().into();
+ if message.is_empty() {
+ message = "Push Successful".into();
+ }
+ remote = None;
+ } else {
+ let remote_message = get_remote_lines(&output.stderr);
+
+ remote = if remote_message.is_empty() {
+ None
+ } else {
+ let finder = LinkFinder::new();
+ let links = finder
+ .links(&remote_message)
+ .filter(|link| *link.kind() == LinkKind::Url)
+ .map(|link| link.start()..link.end())
+ .collect_vec();
+
+ Some(InfoFromRemote {
+ name: remote_ref.name,
+ remote_text: remote_message.into(),
+ links,
+ })
+ }
+ }
}
}