From e982ff7bb93c72508976375eb7c1323ddc8ea10c Mon Sep 17 00:00:00 2001 From: mertkanakkoc Date: Fri, 29 May 2026 02:00:03 +0300 Subject: [PATCH] git_ui/git_panel: fix to show commit history in detached HEAD state --- crates/git_ui/src/git_panel.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 8a7f3c5a134..3d30f368a81 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -5230,11 +5230,12 @@ impl GitPanel { return; }; - let Some(branch) = active_repository.read(cx).branch.as_ref() else { - return; - }; - - let branch_name = branch.name().to_string(); + let branch_name = active_repository + .read(cx) + .branch + .as_ref() + .map(|b| b.name().to_string()) + .unwrap_or_else(|| "HEAD".to_string()); let log_source = LogSource::Branch(branch_name.into()); let log_order = LogOrder::DateOrder; @@ -5275,11 +5276,12 @@ impl GitPanel { return; }; - let Some(branch) = active_repository.read(cx).branch.as_ref() else { - return; - }; - - let branch_name = branch.name().to_string(); + let branch_name = active_repository + .read(cx) + .branch + .as_ref() + .map(|b| b.name().to_string()) + .unwrap_or_else(|| "HEAD".to_string()); let log_source = LogSource::Branch(branch_name.into()); let log_order = LogOrder::DateOrder;