From 6d243474479858bcf6d0f10877ea01fd2db0ee6c Mon Sep 17 00:00:00 2001 From: dino Date: Wed, 8 Oct 2025 18:26:54 +0100 Subject: [PATCH 1/4] fix(git_ui): fix untracked open diff with sort by path Fixes the "Open Diff" action for untracked files with the `sort_by_path` setting is enabled. --- crates/git_ui/src/project_diff.rs | 36 ++++++++++++++----------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index 0e59d25222b51d..ccbc8ef5a5f6f7 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -16,7 +16,7 @@ use editor::{ use futures::StreamExt; use git::{ Commit, StageAll, StageAndNext, ToggleStaged, UnstageAll, UnstageAndNext, - repository::{Branch, Upstream, UpstreamTracking, UpstreamTrackingStatus}, + repository::{Branch, RepoPath, Upstream, UpstreamTracking, UpstreamTrackingStatus}, status::FileStatus, }; use gpui::{ @@ -27,7 +27,7 @@ use language::{Anchor, Buffer, Capability, OffsetRangeExt}; use multi_buffer::{MultiBuffer, PathKey}; use project::{ Project, ProjectPath, - git_store::{GitStore, GitStoreEvent}, + git_store::{GitStore, GitStoreEvent, Repository}, }; use settings::{Settings, SettingsStore}; use std::any::{Any, TypeId}; @@ -234,15 +234,7 @@ impl ProjectDiff { return; }; let repo = git_repo.read(cx); - - let namespace = if repo.had_conflict_on_last_merge_head_change(&entry.repo_path) { - CONFLICT_NAMESPACE - } else if entry.status.is_created() { - NEW_NAMESPACE - } else { - TRACKED_NAMESPACE - }; - + let namespace = namespace(repo, &entry.repo_path, entry.status, cx); let path_key = PathKey::namespaced(namespace, entry.repo_path.0); self.move_to_path(path_key, window, cx) @@ -388,15 +380,7 @@ impl ProjectDiff { else { continue; }; - let namespace = if GitPanelSettings::get_global(cx).sort_by_path { - TRACKED_NAMESPACE - } else if repo.had_conflict_on_last_merge_head_change(&entry.repo_path) { - CONFLICT_NAMESPACE - } else if entry.status.is_created() { - NEW_NAMESPACE - } else { - TRACKED_NAMESPACE - }; + let namespace = namespace(repo, &entry.repo_path, entry.status, cx); let path_key = PathKey::namespaced(namespace, entry.repo_path.0.clone()); previous_paths.remove(&path_key); @@ -541,6 +525,18 @@ impl ProjectDiff { } } +fn namespace(repo: &Repository, repo_path: &RepoPath, status: FileStatus, cx: &App) -> u64 { + if GitPanelSettings::get_global(cx).sort_by_path { + TRACKED_NAMESPACE + } else if repo.had_conflict_on_last_merge_head_change(repo_path) { + CONFLICT_NAMESPACE + } else if status.is_created() { + NEW_NAMESPACE + } else { + TRACKED_NAMESPACE + } +} + impl EventEmitter for ProjectDiff {} impl Focusable for ProjectDiff { From cd560685cd1b17e378499c0f3784f1896410b4ea Mon Sep 17 00:00:00 2001 From: dino Date: Thu, 9 Oct 2025 11:14:38 +0100 Subject: [PATCH 2/4] test(git_ui): open diff with sort by path interaction --- crates/git_ui/src/git_panel.rs | 167 +++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 4c76030f5f596e..c95cea1f32a981 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -4894,6 +4894,7 @@ mod tests { use settings::SettingsStore; use theme::LoadThemes; use util::path; + use util::rel_path::rel_path; use super::*; @@ -5516,6 +5517,172 @@ mod tests { }); } + #[gpui::test] + async fn test_open_diff(cx: &mut TestAppContext) { + init_test(cx); + + let fs = FakeFs::new(cx.background_executor.clone()); + fs.insert_tree( + path!("/project"), + json!({ + ".git": {}, + "tracked": "tracked\n", + "untracked": "\n", + }), + ) + .await; + + fs.set_head_and_index_for_repo( + path!("/project/.git").as_ref(), + &[("tracked", "old tracked\n".into())], + ); + + let project = Project::test(fs.clone(), [Path::new(path!("/project"))], cx).await; + let workspace = + cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx)); + let cx = &mut VisualTestContext::from_window(*workspace, cx); + + cx.read(|cx| { + project + .read(cx) + .worktrees(cx) + .next() + .unwrap() + .read(cx) + .as_local() + .unwrap() + .scan_complete() + }) + .await; + + cx.executor().run_until_parked(); + + let panel = workspace.update(cx, GitPanel::new).unwrap(); + let handle = cx.update_window_entity(&panel, |panel, _, _| { + std::mem::replace(&mut panel.update_visible_entries_task, Task::ready(())) + }); + cx.executor().advance_clock(2 * UPDATE_DEBOUNCE); + handle.await; + + let entries = panel.read_with(cx, |panel, _| panel.entries.clone()); + #[rustfmt::skip] + pretty_assertions::assert_matches!( + entries.as_slice(), + &[ + GitListEntry::Header(GitHeaderEntry { header: Section::Tracked }), + GitListEntry::Status(GitStatusEntry { status: FileStatus::Tracked(..), .. }), + GitListEntry::Header(GitHeaderEntry { header: Section::New }), + GitListEntry::Status(GitStatusEntry { status: FileStatus::Untracked, .. }), + ], + ); + assert_entry_paths(&entries, &[None, Some("tracked"), None, Some("untracked")]); + + // Run the `Open Diff` action for the untracked file, asserting that the + // Project Diff's active path matches the untracked file's path. + panel.update_in(cx, |panel, window, cx| { + panel.selected_entry = Some(3); + panel.open_diff(&Confirm, window, cx); + }); + cx.run_until_parked(); + + let _ = workspace.update(cx, |workspace, _window, cx| { + let active_path = workspace + .item_of_type::(cx) + .expect("ProjectDiff should exist") + .read(cx) + .active_path(cx) + .expect("active_path should exist"); + + assert_eq!(active_path.path, rel_path("untracked").into_arc()); + }); + + // Run the `Open Diff` action for the tracked file, asserting that the + // Project Diff's active path matches the tracked file's path. + panel.update_in(cx, |panel, window, cx| { + panel.selected_entry = Some(1); + panel.open_diff(&Confirm, window, cx); + }); + cx.run_until_parked(); + + let _ = workspace.update(cx, |workspace, _window, cx| { + let active_path = workspace + .item_of_type::(cx) + .expect("ProjectDiff should exist") + .read(cx) + .active_path(cx) + .expect("active_path should exist"); + + assert_eq!(active_path.path, rel_path("tracked").into_arc()); + }); + + // Enable the `sort_by_path` setting and wait for entries to be updated, + // as there should no longer be separators between Tracked and Untracked + // files. + cx.update(|_window, cx| { + SettingsStore::update_global(cx, |store, cx| { + store.update_user_settings(cx, |settings| { + settings.git_panel.get_or_insert_default().sort_by_path = Some(true); + }) + }); + }); + + cx.read(|cx| { + project + .read(cx) + .worktrees(cx) + .next() + .unwrap() + .read(cx) + .as_local() + .unwrap() + .scan_complete() + }) + .await; + + cx.executor().run_until_parked(); + + let handle = cx.update_window_entity(&panel, |panel, _, _| { + std::mem::replace(&mut panel.update_visible_entries_task, Task::ready(())) + }); + cx.executor().advance_clock(2 * UPDATE_DEBOUNCE); + handle.await; + + let entries = panel.read_with(cx, |panel, _| panel.entries.clone()); + pretty_assertions::assert_matches!( + entries.as_slice(), + &[ + GitListEntry::Status(GitStatusEntry { + status: FileStatus::Tracked(..), + .. + }), + GitListEntry::Status(GitStatusEntry { + status: FileStatus::Untracked, + .. + }), + ], + ); + assert_entry_paths(&entries, &[Some("tracked"), Some("untracked")]); + + // Confirm that `Open Diff` still works for the untracked file, updating + // the Project Diff's active path. + panel.update_in(cx, |panel, window, cx| { + panel.selected_entry = Some(1); + panel.open_diff(&Confirm, window, cx); + }); + cx.run_until_parked(); + + let _ = workspace.update(cx, |workspace, _window, cx| { + let active_path = workspace + .item_of_type::(cx) + .expect("ProjectDiff should exist") + .read(cx) + .active_path(cx) + .expect("active_path should exist"); + + assert_eq!(active_path.path, rel_path("untracked").into_arc()); + }); + } + fn assert_entry_paths(entries: &[GitListEntry], expected_paths: &[Option<&str>]) { assert_eq!(entries.len(), expected_paths.len()); for (entry, expected_path) in entries.iter().zip(expected_paths) { From 04e63affd72c845c0492096ef55589b254fe3034 Mon Sep 17 00:00:00 2001 From: dino Date: Thu, 9 Oct 2025 15:09:47 +0100 Subject: [PATCH 3/4] refactor(git_ui): clean up test and add documentation Co-authored-by: David Kleingeld --- crates/git_ui/src/git_panel.rs | 108 +----------------------- crates/git_ui/src/project_diff.rs | 1 + crates/multi_buffer/src/multi_buffer.rs | 3 + 3 files changed, 6 insertions(+), 106 deletions(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index c95cea1f32a981..37e4bd2cef6199 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -5541,79 +5541,7 @@ mod tests { let workspace = cx.add_window(|window, cx| Workspace::test_new(project.clone(), window, cx)); let cx = &mut VisualTestContext::from_window(*workspace, cx); - - cx.read(|cx| { - project - .read(cx) - .worktrees(cx) - .next() - .unwrap() - .read(cx) - .as_local() - .unwrap() - .scan_complete() - }) - .await; - - cx.executor().run_until_parked(); - let panel = workspace.update(cx, GitPanel::new).unwrap(); - let handle = cx.update_window_entity(&panel, |panel, _, _| { - std::mem::replace(&mut panel.update_visible_entries_task, Task::ready(())) - }); - cx.executor().advance_clock(2 * UPDATE_DEBOUNCE); - handle.await; - - let entries = panel.read_with(cx, |panel, _| panel.entries.clone()); - #[rustfmt::skip] - pretty_assertions::assert_matches!( - entries.as_slice(), - &[ - GitListEntry::Header(GitHeaderEntry { header: Section::Tracked }), - GitListEntry::Status(GitStatusEntry { status: FileStatus::Tracked(..), .. }), - GitListEntry::Header(GitHeaderEntry { header: Section::New }), - GitListEntry::Status(GitStatusEntry { status: FileStatus::Untracked, .. }), - ], - ); - assert_entry_paths(&entries, &[None, Some("tracked"), None, Some("untracked")]); - - // Run the `Open Diff` action for the untracked file, asserting that the - // Project Diff's active path matches the untracked file's path. - panel.update_in(cx, |panel, window, cx| { - panel.selected_entry = Some(3); - panel.open_diff(&Confirm, window, cx); - }); - cx.run_until_parked(); - - let _ = workspace.update(cx, |workspace, _window, cx| { - let active_path = workspace - .item_of_type::(cx) - .expect("ProjectDiff should exist") - .read(cx) - .active_path(cx) - .expect("active_path should exist"); - - assert_eq!(active_path.path, rel_path("untracked").into_arc()); - }); - - // Run the `Open Diff` action for the tracked file, asserting that the - // Project Diff's active path matches the tracked file's path. - panel.update_in(cx, |panel, window, cx| { - panel.selected_entry = Some(1); - panel.open_diff(&Confirm, window, cx); - }); - cx.run_until_parked(); - - let _ = workspace.update(cx, |workspace, _window, cx| { - let active_path = workspace - .item_of_type::(cx) - .expect("ProjectDiff should exist") - .read(cx) - .active_path(cx) - .expect("active_path should exist"); - - assert_eq!(active_path.path, rel_path("tracked").into_arc()); - }); // Enable the `sort_by_path` setting and wait for entries to be updated, // as there should no longer be separators between Tracked and Untracked @@ -5626,43 +5554,11 @@ mod tests { }); }); - cx.read(|cx| { - project - .read(cx) - .worktrees(cx) - .next() - .unwrap() - .read(cx) - .as_local() - .unwrap() - .scan_complete() + cx.update_window_entity(&panel, |panel, _, _| { + std::mem::replace(&mut panel.update_visible_entries_task, Task::ready(())) }) .await; - cx.executor().run_until_parked(); - - let handle = cx.update_window_entity(&panel, |panel, _, _| { - std::mem::replace(&mut panel.update_visible_entries_task, Task::ready(())) - }); - cx.executor().advance_clock(2 * UPDATE_DEBOUNCE); - handle.await; - - let entries = panel.read_with(cx, |panel, _| panel.entries.clone()); - pretty_assertions::assert_matches!( - entries.as_slice(), - &[ - GitListEntry::Status(GitStatusEntry { - status: FileStatus::Tracked(..), - .. - }), - GitListEntry::Status(GitStatusEntry { - status: FileStatus::Untracked, - .. - }), - ], - ); - assert_entry_paths(&entries, &[Some("tracked"), Some("untracked")]); - // Confirm that `Open Diff` still works for the untracked file, updating // the Project Diff's active path. panel.update_in(cx, |panel, window, cx| { diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index ccbc8ef5a5f6f7..b85ab97a51f568 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -73,6 +73,7 @@ struct DiffBuffer { file_status: FileStatus, } +// These influence the sort order const CONFLICT_NAMESPACE: u64 = 1; const TRACKED_NAMESPACE: u64 = 2; const NEW_NAMESPACE: u64 = 3; diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 067c9829a3d549..690133294b975a 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -161,6 +161,9 @@ impl MultiBufferDiffHunk { #[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Hash, Debug)] pub struct PathKey { + // Used by the derived PartialOrd & Ord, enables us to devide a sorted list + // in sections based on the namespace. Like files with conflicts then + // changed files etc namespace: Option, path: Arc, } From e53cc0daa362347926356a2058d26925f19efab2 Mon Sep 17 00:00:00 2001 From: dino Date: Thu, 9 Oct 2025 15:16:57 +0100 Subject: [PATCH 4/4] refactor(multi_buffer): rename namespace to sort_prefix Co-authored-by: David Kleingeld --- crates/editor/src/editor_tests.rs | 6 ++-- crates/git_ui/src/commit_view.rs | 8 ++--- crates/git_ui/src/project_diff.rs | 29 +++++++++---------- crates/multi_buffer/src/multi_buffer.rs | 14 ++++----- crates/multi_buffer/src/multi_buffer_tests.rs | 8 ++--- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index 3dfed1905f934b..1cba5bff798748 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -16515,7 +16515,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut TestAppContext) { leader.update(cx, |leader, cx| { leader.buffer.update(cx, |multibuffer, cx| { multibuffer.set_excerpts_for_path( - PathKey::namespaced(1, rel_path("b.txt").into_arc()), + PathKey::with_sort_prefix(1, rel_path("b.txt").into_arc()), buffer_1.clone(), vec![ Point::row_range(0..3), @@ -16526,7 +16526,7 @@ async fn test_following_with_multiple_excerpts(cx: &mut TestAppContext) { cx, ); multibuffer.set_excerpts_for_path( - PathKey::namespaced(1, rel_path("a.txt").into_arc()), + PathKey::with_sort_prefix(1, rel_path("a.txt").into_arc()), buffer_2.clone(), vec![Point::row_range(0..6), Point::row_range(8..12)], 0, @@ -21029,7 +21029,7 @@ async fn test_display_diff_hunks(cx: &mut TestAppContext) { for buffer in &buffers { let snapshot = buffer.read(cx).snapshot(); multibuffer.set_excerpts_for_path( - PathKey::namespaced(0, buffer.read(cx).file().unwrap().path().clone()), + PathKey::with_sort_prefix(0, buffer.read(cx).file().unwrap().path().clone()), buffer.clone(), vec![text::Anchor::MIN.to_point(&snapshot)..text::Anchor::MAX.to_point(&snapshot)], 2, diff --git a/crates/git_ui/src/commit_view.rs b/crates/git_ui/src/commit_view.rs index a87db56c968ce5..201a699e2f0e85 100644 --- a/crates/git_ui/src/commit_view.rs +++ b/crates/git_ui/src/commit_view.rs @@ -43,8 +43,8 @@ struct CommitMetadataFile { worktree_id: WorktreeId, } -const COMMIT_METADATA_NAMESPACE: u64 = 0; -const FILE_NAMESPACE: u64 = 1; +const COMMIT_METADATA_SORT_PREFIX: u64 = 0; +const FILE_NAMESPACE_SORT_PREFIX: u64 = 1; impl CommitView { pub fn open( @@ -145,7 +145,7 @@ impl CommitView { }); multibuffer.update(cx, |multibuffer, cx| { multibuffer.set_excerpts_for_path( - PathKey::namespaced(COMMIT_METADATA_NAMESPACE, file.title.clone()), + PathKey::with_sort_prefix(COMMIT_METADATA_SORT_PREFIX, file.title.clone()), buffer.clone(), vec![Point::zero()..buffer.read(cx).max_point()], 0, @@ -193,7 +193,7 @@ impl CommitView { .collect::>(); let path = snapshot.file().unwrap().path().clone(); let _is_newly_added = multibuffer.set_excerpts_for_path( - PathKey::namespaced(FILE_NAMESPACE, path), + PathKey::with_sort_prefix(FILE_NAMESPACE_SORT_PREFIX, path), buffer, diff_hunk_ranges, multibuffer_context_lines(cx), diff --git a/crates/git_ui/src/project_diff.rs b/crates/git_ui/src/project_diff.rs index b85ab97a51f568..6b70f1975e8f36 100644 --- a/crates/git_ui/src/project_diff.rs +++ b/crates/git_ui/src/project_diff.rs @@ -73,10 +73,9 @@ struct DiffBuffer { file_status: FileStatus, } -// These influence the sort order -const CONFLICT_NAMESPACE: u64 = 1; -const TRACKED_NAMESPACE: u64 = 2; -const NEW_NAMESPACE: u64 = 3; +const CONFLICT_SORT_PREFIX: u64 = 1; +const TRACKED_SORT_PREFIX: u64 = 2; +const NEW_SORT_PREFIX: u64 = 3; impl ProjectDiff { pub(crate) fn register(workspace: &mut Workspace, cx: &mut Context) { @@ -235,8 +234,8 @@ impl ProjectDiff { return; }; let repo = git_repo.read(cx); - let namespace = namespace(repo, &entry.repo_path, entry.status, cx); - let path_key = PathKey::namespaced(namespace, entry.repo_path.0); + let sort_prefix = sort_prefix(repo, &entry.repo_path, entry.status, cx); + let path_key = PathKey::with_sort_prefix(sort_prefix, entry.repo_path.0); self.move_to_path(path_key, window, cx) } @@ -381,8 +380,8 @@ impl ProjectDiff { else { continue; }; - let namespace = namespace(repo, &entry.repo_path, entry.status, cx); - let path_key = PathKey::namespaced(namespace, entry.repo_path.0.clone()); + let sort_prefix = sort_prefix(repo, &entry.repo_path, entry.status, cx); + let path_key = PathKey::with_sort_prefix(sort_prefix, entry.repo_path.0.clone()); previous_paths.remove(&path_key); let load_buffer = self @@ -526,15 +525,15 @@ impl ProjectDiff { } } -fn namespace(repo: &Repository, repo_path: &RepoPath, status: FileStatus, cx: &App) -> u64 { +fn sort_prefix(repo: &Repository, repo_path: &RepoPath, status: FileStatus, cx: &App) -> u64 { if GitPanelSettings::get_global(cx).sort_by_path { - TRACKED_NAMESPACE + TRACKED_SORT_PREFIX } else if repo.had_conflict_on_last_merge_head_change(repo_path) { - CONFLICT_NAMESPACE + CONFLICT_SORT_PREFIX } else if status.is_created() { - NEW_NAMESPACE + NEW_SORT_PREFIX } else { - TRACKED_NAMESPACE + TRACKED_SORT_PREFIX } } @@ -1460,7 +1459,7 @@ mod tests { let editor = cx.update_window_entity(&diff, |diff, window, cx| { diff.move_to_path( - PathKey::namespaced(TRACKED_NAMESPACE, rel_path("foo").into_arc()), + PathKey::with_sort_prefix(TRACKED_SORT_PREFIX, rel_path("foo").into_arc()), window, cx, ); @@ -1481,7 +1480,7 @@ mod tests { let editor = cx.update_window_entity(&diff, |diff, window, cx| { diff.move_to_path( - PathKey::namespaced(TRACKED_NAMESPACE, rel_path("bar").into_arc()), + PathKey::with_sort_prefix(TRACKED_SORT_PREFIX, rel_path("bar").into_arc()), window, cx, ); diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 690133294b975a..466d57e3f80cbf 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -161,27 +161,25 @@ impl MultiBufferDiffHunk { #[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Hash, Debug)] pub struct PathKey { - // Used by the derived PartialOrd & Ord, enables us to devide a sorted list - // in sections based on the namespace. Like files with conflicts then - // changed files etc - namespace: Option, + // Used by the derived PartialOrd & Ord + sort_prefix: Option, path: Arc, } impl PathKey { - pub fn namespaced(namespace: u64, path: Arc) -> Self { + pub fn with_sort_prefix(sort_prefix: u64, path: Arc) -> Self { Self { - namespace: Some(namespace), + sort_prefix: Some(sort_prefix), path, } } pub fn for_buffer(buffer: &Entity, cx: &App) -> Self { if let Some(file) = buffer.read(cx).file() { - Self::namespaced(file.worktree_id(cx).to_proto(), file.path().clone()) + Self::with_sort_prefix(file.worktree_id(cx).to_proto(), file.path().clone()) } else { Self { - namespace: None, + sort_prefix: None, path: RelPath::unix(&buffer.entity_id().to_string()) .unwrap() .into_arc(), diff --git a/crates/multi_buffer/src/multi_buffer_tests.rs b/crates/multi_buffer/src/multi_buffer_tests.rs index e82c44d644ba52..bad99d5412cd00 100644 --- a/crates/multi_buffer/src/multi_buffer_tests.rs +++ b/crates/multi_buffer/src/multi_buffer_tests.rs @@ -1525,7 +1525,7 @@ fn test_set_excerpts_for_buffer_ordering(cx: &mut TestAppContext) { cx, ) }); - let path1: PathKey = PathKey::namespaced(0, rel_path("root").into_arc()); + let path1: PathKey = PathKey::with_sort_prefix(0, rel_path("root").into_arc()); let multibuffer = cx.new(|_| MultiBuffer::new(Capability::ReadWrite)); multibuffer.update(cx, |multibuffer, cx| { @@ -1620,7 +1620,7 @@ fn test_set_excerpts_for_buffer(cx: &mut TestAppContext) { cx, ) }); - let path1: PathKey = PathKey::namespaced(0, rel_path("root").into_arc()); + let path1: PathKey = PathKey::with_sort_prefix(0, rel_path("root").into_arc()); let buf2 = cx.new(|cx| { Buffer::local( indoc! { @@ -1639,7 +1639,7 @@ fn test_set_excerpts_for_buffer(cx: &mut TestAppContext) { cx, ) }); - let path2 = PathKey::namespaced(1, rel_path("root").into_arc()); + let path2 = PathKey::with_sort_prefix(1, rel_path("root").into_arc()); let multibuffer = cx.new(|_| MultiBuffer::new(Capability::ReadWrite)); multibuffer.update(cx, |multibuffer, cx| { @@ -1816,7 +1816,7 @@ fn test_set_excerpts_for_buffer_rename(cx: &mut TestAppContext) { cx, ) }); - let path: PathKey = PathKey::namespaced(0, rel_path("root").into_arc()); + let path: PathKey = PathKey::with_sort_prefix(0, rel_path("root").into_arc()); let buf2 = cx.new(|cx| { Buffer::local( indoc! {