git: Fix panic in git2 due to empty repo paths (#42304)
Fixes ZED-1VR Release Notes: - Fixed sporadic panic in git features
This commit is contained in:
@@ -879,7 +879,7 @@ impl GitPanel {
|
||||
let active_repository = self.active_repository.as_ref()?.downgrade();
|
||||
|
||||
cx.spawn(async move |_, cx| {
|
||||
let file_path_str = repo_path.0.display(PathStyle::Posix);
|
||||
let file_path_str = repo_path.as_ref().display(PathStyle::Posix);
|
||||
|
||||
let repo_root = active_repository.read_with(cx, |repository, _| {
|
||||
repository.snapshot().work_directory_abs_path
|
||||
@@ -1074,7 +1074,7 @@ impl GitPanel {
|
||||
}
|
||||
let mut details = entries
|
||||
.iter()
|
||||
.filter_map(|entry| entry.repo_path.0.file_name())
|
||||
.filter_map(|entry| entry.repo_path.as_ref().file_name())
|
||||
.map(|filename| filename.to_string())
|
||||
.take(5)
|
||||
.join("\n");
|
||||
@@ -1129,7 +1129,7 @@ impl GitPanel {
|
||||
.map(|entry| {
|
||||
entry
|
||||
.repo_path
|
||||
.0
|
||||
.as_ref()
|
||||
.file_name()
|
||||
.map(|f| f.to_string())
|
||||
.unwrap_or_default()
|
||||
@@ -5647,7 +5647,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
entry.status_entry().map(|status| status
|
||||
.repo_path
|
||||
.0
|
||||
.as_ref()
|
||||
.as_std_path()
|
||||
.to_string_lossy()
|
||||
.to_string()),
|
||||
|
||||
Reference in New Issue
Block a user