Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add "File History" option to Git Panel entry context menu (#44016)
Joseph T. Lyonsd283338885d2
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rsindex 8579cafa58a..092768c2cd9 100644--- a/crates/git_ui/src/git_panel.rs+++ b/crates/git_ui/src/git_panel.rs@@ -6,7 +6,8 @@ use crate::project_diff::{self, Diff, ProjectDiff};use crate::remote_output::{self, RemoteAction, SuccessMessage};use crate::{branch_picker, picker_prompt, render_remote_button};use crate::{- git_panel_settings::GitPanelSettings, git_status_icon, repository_selector::RepositorySelector,+ file_history_view::FileHistoryView, git_panel_settings::GitPanelSettings, git_status_icon,+ repository_selector::RepositorySelector,};use agent_settings::AgentSettings;use anyhow::Context as _;@@ -842,6 +843,26 @@ impl GitPanel {});}+ fn file_history(&mut self, _: &git::FileHistory, window: &mut Window, cx: &mut Context<Self>) {+ maybe!({+ let entry = self.entries.get(self.selected_entry?)?.status_entry()?;+ let active_repo = self.active_repository.as_ref()?;+ let repo_path = entry.repo_path.clone();+ let git_store = self.project.read(cx).git_store();++ FileHistoryView::open(+ repo_path,+ git_store.downgrade(),+ active_repo.downgrade(),+ self.workspace.clone(),+ window,+ cx,+ );++ Some(())+ });+ }+fn open_file(&mut self,_: &menu::SecondaryConfirm,@@ -3997,6 +4018,8 @@ impl GitPanel {.separator().action("Open Diff", Confirm.boxed_clone()).action("Open File", SecondaryConfirm.boxed_clone())+ .separator()+ .action("File History", Box::new(git::FileHistory))});self.selected_entry = Some(ix);self.set_context_menu(context_menu, position, window, cx);@@ -4499,6 +4522,7 @@ impl Render for GitPanel {.on_action(cx.listener(Self::close_panel)).on_action(cx.listener(Self::open_diff)).on_action(cx.listener(Self::open_file))+ .on_action(cx.listener(Self::file_history)).on_action(cx.listener(Self::focus_changes_list)).on_action(cx.listener(Self::focus_editor)).on_action(cx.listener(Self::expand_commit_editor))