From 2bf47879dee6dc8c21613b83e058a1dd4b9bde29 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Tue, 2 Dec 2025 20:47:01 -0500 Subject: [PATCH] Hide "File History" for untracked files in Git Panel context menu (#44035) --- crates/git_ui/src/git_panel.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 092768c2cd97fa82079979301704ee66c969196e..bd17788506faa62f33618d4450000af1e7b8aec9 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -4011,15 +4011,21 @@ impl GitPanel { if entry.status.is_created() { context_menu = - context_menu.action("Add to .gitignore", git::AddToGitignore.boxed_clone()); + context_menu.action("Add to .gitignore", git::AddToGitignore.boxed_clone()) } - context_menu + let mut context_menu = context_menu .separator() .action("Open Diff", Confirm.boxed_clone()) - .action("Open File", SecondaryConfirm.boxed_clone()) - .separator() - .action("File History", Box::new(git::FileHistory)) + .action("Open File", SecondaryConfirm.boxed_clone()); + + if !entry.status.is_created() { + context_menu = context_menu + .separator() + .action("File History", Box::new(git::FileHistory)); + } + + context_menu }); self.selected_entry = Some(ix); self.set_context_menu(context_menu, position, window, cx);