From bda469b42ce8a959d13c329b7724c40f6ff976d9 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Thu, 20 Nov 2025 07:06:56 +0000 Subject: [PATCH] Fix panic in the git panel when toggling `sort_by_path` (#43074) (cherry-pick to stable) (#43129) Cherry-pick of #43074 to stable ---- We call `entry_by_path` on the `bulk_staging` anchor entry at the beginning of `update_visible_entries`, but in the codepath where `sort_by_path` is toggled on or off, we clear entries without clearing `bulk_staging` or counts, causing that `entry_by_path` to do an out of bounds index. Fixed by clearing `bulk_staging` as well. Release Notes: - N/A Co-authored-by: Cole Miller --- crates/git_ui/src/git_panel.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 2e60fc2fb839bb30f9115e0d1224fa94f5ddae85..790b6a402e37f5e8ea10c4cd685548f268b9c435 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -371,6 +371,7 @@ impl GitPanel { let is_sort_by_path = GitPanelSettings::get_global(cx).sort_by_path; if is_sort_by_path != was_sort_by_path { this.entries.clear(); + this.bulk_staging.take(); this.update_visible_entries(window, cx); } was_sort_by_path = is_sort_by_path