From 42a5081aff91e07fdea5a19cc3d92da750f5704a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=B1=B1=E9=A2=A8=E9=9C=B2?= Date: Thu, 8 Feb 2024 01:27:26 +0900 Subject: [PATCH] Use try_from_bytes for windows build (#7500) Reduce windows build error. Release Notes: - N/A --- crates/fs/src/repository.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/fs/src/repository.rs b/crates/fs/src/repository.rs index 4bd666381c..66dd0503cf 100644 --- a/crates/fs/src/repository.rs +++ b/crates/fs/src/repository.rs @@ -5,14 +5,12 @@ use parking_lot::Mutex; use serde_derive::{Deserialize, Serialize}; use std::{ cmp::Ordering, - ffi::OsStr, - os::unix::prelude::OsStrExt, path::{Component, Path, PathBuf}, sync::Arc, time::SystemTime, }; use sum_tree::{MapSeekTarget, TreeMap}; -use util::ResultExt; +use util::{paths::PathExt, ResultExt}; pub use git2::Repository as LibGitRepository; @@ -119,7 +117,7 @@ impl GitRepository for LibGitRepository { if let Some(statuses) = self.statuses(Some(&mut options)).log_err() { for status in statuses.iter() { - let path = RepoPath(PathBuf::from(OsStr::from_bytes(status.path_bytes()))); + let path = RepoPath(PathBuf::try_from_bytes(status.path_bytes()).unwrap()); let status = status.status(); if !status.contains(git2::Status::IGNORED) { if let Some(status) = read_status(status) {