Make SanitizedPath wrap Path instead of Arc<Path> to avoid allocation (#37106)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan
2025-08-28 13:32:30 -06:00
committed by GitHub
parent 69933d5b81
commit 47aaaa8bcf
14 changed files with 156 additions and 85 deletions
+2 -1
View File
@@ -62,7 +62,7 @@ use std::{
};
use sum_tree::{Edit, SumTree, TreeSet};
use text::{Bias, BufferId};
use util::{ResultExt, debug_panic, post_inc};
use util::{ResultExt, debug_panic, paths::SanitizedPath, post_inc};
use worktree::{
File, PathChange, PathKey, PathProgress, PathSummary, PathTarget, ProjectEntryId,
UpdatedGitRepositoriesSet, UpdatedGitRepository, Worktree,
@@ -3234,6 +3234,7 @@ impl Repository {
let git_store = self.git_store.upgrade()?;
let worktree_store = git_store.read(cx).worktree_store.read(cx);
let abs_path = self.snapshot.work_directory_abs_path.join(&path.0);
let abs_path = SanitizedPath::new(&abs_path);
let (worktree, relative_path) = worktree_store.find_worktree(abs_path, cx)?;
Some(ProjectPath {
worktree_id: worktree.read(cx).id(),