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_graph: Remove commit preview on row hover (#61191)

Danilo Lealfd013f7f560d
diff --git a/crates/git_ui/src/git_graph.rs b/crates/git_ui/src/git_graph.rs
index cd3c751bcfe..6e1ddd12de3 100644
--- a/crates/git_ui/src/git_graph.rs
+++ b/crates/git_ui/src/git_graph.rs
@@ -1,7 +1,7 @@
pub use crate::commit_context_menu::{CopyCommitSha, CopyCommitTag, OpenCommitView};
use crate::{
commit_context_menu::{CommitContextMenuData, CommitContextMenuSource, commit_context_menu},
- commit_tooltip::{CommitAvatar, CommitDetails, CommitTooltip},
+ commit_tooltip::CommitAvatar,
commit_view::CommitView,
git_status_icon,
};
@@ -10,7 +10,6 @@ use editor::Editor;
use file_icons::FileIcons;
use git::{
BuildCommitPermalinkParams, GitHostingProviderRegistry, GitRemote, Oid, ParsedGitRemote,
- commit::ParsedCommitMessage,
parse_git_remote_url,
repository::{
CommitDiff, CommitFile, InitialGraphCommitData, LogOrder, LogSource, RepoPath,
@@ -1694,10 +1693,6 @@ impl GitGraph {
git_store.repositories().get(&self.repo_id).cloned()
}
- fn has_context_menu(&self) -> bool {
- self.context_menu.is_some()
- }
-
/// Checks whether a ref name from git's `%D` decoration
/// format refers to the currently checked-out branch.
fn is_head_ref(ref_name: &str, head_branch_name: &Option<SharedString>) -> bool {
@@ -1791,7 +1786,6 @@ impl GitGraph {
});
let row_height = Self::row_height(window, cx);
- let has_context_menu = self.has_context_menu();
// We fetch data outside the visible viewport to avoid loading entries when
// users scroll through the git graph
@@ -1899,55 +1893,6 @@ impl GitGraph {
div()
.id(ElementId::NamedInteger("commit-subject".into(), idx as u64))
.overflow_hidden()
- .when(!has_context_menu, |this| {
- if let CommitDataState::Loaded(commit_data) = &data {
- let sha = commit.data.sha.to_string();
- let author_name = commit_data.author_name.clone();
- let author_email = commit_data.author_email.clone();
- let message = commit_data.message.clone();
- let commit_timestamp = commit_data.commit_timestamp;
- let tag_names = commit
- .data
- .tag_names()
- .into_iter()
- .map(SharedString::from)
- .collect::<Vec<_>>();
- let workspace = self.workspace.clone();
- let repository = repository.clone();
- this.hoverable_tooltip(move |_window, cx| {
- let remote_url = repository.read(cx).default_remote_url();
- let provider_registry =
- GitHostingProviderRegistry::default_global(cx);
- let commit_details = CommitDetails {
- sha: sha.clone().into(),
- author_name: author_name.clone(),
- author_email: author_email.clone(),
- commit_time: OffsetDateTime::from_unix_timestamp(
- commit_timestamp,
- )
- .unwrap_or_else(|_| OffsetDateTime::now_utc()),
- message: Some(ParsedCommitMessage::parse(
- sha.clone(),
- message.to_string(),
- remote_url.as_deref(),
- Some(provider_registry),
- )),
- tag_names: tag_names.clone(),
- };
- cx.new(|cx| {
- CommitTooltip::new(
- commit_details,
- repository.clone(),
- workspace.clone(),
- cx,
- )
- })
- .into()
- })
- } else {
- this
- }
- })
.child(
h_flex()
.gap_2()