Clean up RelPath API (#38912)
Consolidate constructors and accessors. Release Notes: - N/A --------- Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
co-authored by
Cole Miller
parent
301e976465
commit
495a7b0a84
@@ -226,7 +226,7 @@ impl GitRepository for FakeGitRepository {
|
||||
.read_file_sync(path)
|
||||
.ok()
|
||||
.map(|content| String::from_utf8(content).unwrap())?;
|
||||
let repo_path = RelPath::from_std_path(repo_path, PathStyle::local()).ok()?;
|
||||
let repo_path = RelPath::new(repo_path, PathStyle::local()).ok()?;
|
||||
Some((repo_path.into(), (content, is_ignored)))
|
||||
})
|
||||
.collect();
|
||||
|
||||
+2
-2
@@ -1671,10 +1671,10 @@ impl FakeFs {
|
||||
for (path, content) in workdir_contents {
|
||||
use util::{paths::PathStyle, rel_path::RelPath};
|
||||
|
||||
let repo_path: RepoPath = RelPath::from_std_path(path.strip_prefix(&workdir_path).unwrap(), PathStyle::local()).unwrap().into();
|
||||
let repo_path: RepoPath = RelPath::new(path.strip_prefix(&workdir_path).unwrap(), PathStyle::local()).unwrap().into();
|
||||
let status = statuses
|
||||
.iter()
|
||||
.find_map(|(p, status)| (*p == repo_path.as_str()).then_some(status));
|
||||
.find_map(|(p, status)| (*p == repo_path.as_unix_str()).then_some(status));
|
||||
let mut content = String::from_utf8_lossy(&content).to_string();
|
||||
|
||||
let mut index_content = None;
|
||||
|
||||
Reference in New Issue
Block a user