From 5e21457f2162b23ee04c3587a5dd6164af978dac Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Wed, 19 Nov 2025 16:53:40 -0500 Subject: [PATCH] Fix panic in the git panel when toggling `sort_by_path` (#43074) 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 --- 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 6889b880623da021bcac64b8cd96d70db817dd5b..cd56473dceb48d3c7da3629818f06d79d656ee03 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -373,6 +373,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