Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git_ui: Ignore extraneous links in git output (#49817)
Kavi Bidlackda93e7dbc62a
diff --git a/crates/git_ui/src/remote_output.rs b/crates/git_ui/src/remote_output.rsindex 8b83b274b89..a5259631e34 100644--- a/crates/git_ui/src/remote_output.rs+++ b/crates/git_ui/src/remote_output.rs@@ -139,14 +139,19 @@ pub fn format_output(action: &RemoteAction, output: RemoteCommandOutput) -> Succ.find(|(indicator, _)| output.stderr.contains(indicator)).and_then(|(_, mapped)| {let finder = LinkFinder::new();- finder- .links(&output.stderr)- .filter(|link| *link.kind() == LinkKind::Url)- .map(|link| link.start()..link.end())- .next()- .map(|link| SuccessStyle::PushPrLink {- text: mapped.to_string(),- link: output.stderr[link].to_string(),++ output+ .stderr+ .lines()+ .filter(|line| line.trim_start().starts_with("remote:"))+ .find_map(|line| {+ finder+ .links(line)+ .find(|link| *link.kind() == LinkKind::Url)+ .map(|link| SuccessStyle::PushPrLink {+ text: mapped.to_string(),+ link: link.as_str().to_string(),+ })})})} else {@@ -245,7 +250,11 @@ mod tests {let output = RemoteCommandOutput {stdout: String::new(),+ // Simulate an extraneous link that should not be found in top 3 linesstderr: indoc! {"+ ** WARNING: connection is not using a post-quantum key exchange algorithm.+ ** This session may be vulnerable to \"store now, decrypt later\" attacks.+ ** The server may need to be upgraded. See https://openssh.com/pq.htmlTotal 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)remote:remote: View merge request for test: