Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
git_ui: Fix double slash in commit URLs (#44996)
Xiaobo Liu4573a59777a9
diff --git a/crates/git_ui/src/commit_view.rs b/crates/git_ui/src/commit_view.rsindex 8cb9d828260..0f5420fec41 100644--- a/crates/git_ui/src/commit_view.rs+++ b/crates/git_ui/src/commit_view.rs@@ -3,7 +3,10 @@ use buffer_diff::{BufferDiff, BufferDiffSnapshot};use editor::display_map::{BlockPlacement, BlockProperties, BlockStyle};use editor::{Editor, EditorEvent, ExcerptRange, MultiBuffer, multibuffer_context_lines};use git::repository::{CommitDetails, CommitDiff, RepoPath};-use git::{GitHostingProviderRegistry, GitRemote, parse_git_remote_url};+use git::{+ BuildCommitPermalinkParams, GitHostingProviderRegistry, GitRemote, ParsedGitRemote,+ parse_git_remote_url,+};use gpui::{AnyElement, App, AppContext as _, AsyncApp, AsyncWindowContext, Context, Element, Entity,EventEmitter, FocusHandle, Focusable, InteractiveElement, IntoElement, ParentElement,@@ -393,13 +396,15 @@ impl CommitView {let remote_info = self.remote.as_ref().map(|remote| {let provider = remote.host.name();- let url = format!(- "{}/{}/{}/commit/{}",- remote.host.base_url(),- remote.owner,- remote.repo,- commit.sha- );+ let parsed_remote = ParsedGitRemote {+ owner: remote.owner.as_ref().into(),+ repo: remote.repo.as_ref().into(),+ };+ let params = BuildCommitPermalinkParams { sha: &commit.sha };+ let url = remote+ .host+ .build_commit_permalink(&parsed_remote, params)+ .to_string();(provider, url)});