From f39729464052b41abc9d3a5783cbdb8b898fe0d5 Mon Sep 17 00:00:00 2001 From: localcc Date: Tue, 9 Sep 2025 18:50:26 +0200 Subject: [PATCH] Fix git staging in a subfolder (#37860) Closes #37418 Ideal fix for this would be #37855 but that is a large refactor so implementing this as a workaround. Release Notes: - N/A --- crates/worktree/src/worktree.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 7af86d3364f6e07116ae701da83b897869bb905e..2db380fa2f0262142bfb124ce9c22b24efd99c0e 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -4777,8 +4777,10 @@ impl BackgroundScanner { .git_repositories .iter() .find_map(|(_, repo)| { - if repo.common_dir_abs_path.as_ref() == &dot_git_dir - || repo.repository_dir_abs_path.as_ref() == &dot_git_dir + let dot_git_dir = SanitizedPath::new(&dot_git_dir); + if SanitizedPath::new(repo.common_dir_abs_path.as_ref()) == dot_git_dir + || SanitizedPath::new(repo.repository_dir_abs_path.as_ref()) + == dot_git_dir { Some(repo.clone()) } else {