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:
@@ -6,6 +6,7 @@ use buffer_diff::DiffHunkStatusKind;
|
||||
use collections::BTreeMap;
|
||||
use futures::Future;
|
||||
|
||||
use git::repository::RepoPath;
|
||||
use gpui::{
|
||||
AnyWindowHandle, App, Context, Entity, Focusable as _, Keystroke, Pixels, Point,
|
||||
VisualTestContext, Window, WindowHandle, prelude::*,
|
||||
@@ -334,7 +335,10 @@ impl EditorTestContext {
|
||||
let path = self.update_buffer(|buffer, _| buffer.file().unwrap().path().clone());
|
||||
let mut found = None;
|
||||
fs.with_git_state(&Self::root_path().join(".git"), false, |git_state| {
|
||||
found = git_state.index_contents.get(&path.into()).cloned();
|
||||
found = git_state
|
||||
.index_contents
|
||||
.get(&RepoPath::from_rel_path(&path))
|
||||
.cloned();
|
||||
})
|
||||
.unwrap();
|
||||
assert_eq!(expected, found.as_deref());
|
||||
|
||||
Reference in New Issue
Block a user