Fix worktree ordering with PathList (#39944)

The recent introduction of PathList removed some of the ordering logic
resulting in paths always being alphabetised.

This change restores the previous logic for sorting worktrees in a
project using the newer PathList type.

Closes #39934

Release Notes:

- Fixed manual worktree reordering

<details>

<summary>Screen recording of it retaining the order</summary>


https://github.com/user-attachments/assets/0197d118-6ea7-4d2d-8fec-c917fcb9d277

</details>

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
Elliot Thomas
2025-10-13 12:41:42 +02:00
committed by GitHub
co-authored by MrSubidubi
parent f6630ed736
commit 237474a889
5 changed files with 85 additions and 15 deletions
+1 -1
View File
@@ -1539,7 +1539,7 @@ impl Workspace {
persistence::DB.workspace_for_roots(paths_to_open.as_slice());
if let Some(paths) = serialized_workspace.as_ref().map(|ws| &ws.paths) {
paths_to_open = paths.paths().to_vec();
paths_to_open = paths.ordered_paths().cloned().collect();
if !paths.is_lexicographically_ordered() {
project_handle
.update(cx, |project, cx| {