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 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 092768c2cd..bd17788506 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()) + } + + let mut context_menu = context_menu + .separator() + .action("Open Diff", Confirm.boxed_clone()) + .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 - .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);