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:
Lukas Wirth
2025-11-10 09:27:51 +00:00
committed by GitHub
parent 359160c8b1
commit 0149de4b54
13 changed files with 90 additions and 84 deletions
+2 -2
View File
@@ -264,7 +264,7 @@ mod tests {
use super::*;
use fs::FakeFs;
use git::{
repository::repo_path,
repository::{RepoPath, repo_path},
status::{UnmergedStatus, UnmergedStatusCode},
};
use gpui::{BackgroundExecutor, TestAppContext};
@@ -617,7 +617,7 @@ mod tests {
cx.run_until_parked();
fs.with_git_state(path!("/project/.git").as_ref(), true, |state| {
state.unmerged_paths.insert(
rel_path("a.txt").into(),
RepoPath::from_rel_path(rel_path("a.txt")),
UnmergedStatus {
first_head: UnmergedStatusCode::Updated,
second_head: UnmergedStatusCode::Updated,
+2 -2
View File
@@ -46,7 +46,7 @@ impl Item for PendingOps {
fn summary(&self, _cx: ()) -> Self::Summary {
PathSummary {
max_path: self.repo_path.0.clone(),
max_path: self.repo_path.as_ref().clone(),
item_summary: PendingOpsSummary {
staged_count: self.staged() as usize,
staging_count: self.staging() as usize,
@@ -73,7 +73,7 @@ impl KeyedItem for PendingOps {
type Key = PathKey;
fn key(&self) -> Self::Key {
PathKey(self.repo_path.0.clone())
PathKey(self.repo_path.as_ref().clone())
}
}