File tree Expand file tree Collapse file tree 2 files changed +15
-25
lines changed Expand file tree Collapse file tree 2 files changed +15
-25
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,13 @@ impl ThreadSafeRepository {
272272 section
273273 . path
274274 . as_deref ( )
275- . and_then ( |p| gix_path:: normalize ( p. into ( ) , current_dir) )
275+ . and_then ( |p| {
276+ if p. exists ( ) {
277+ gix_path:: realpath_opts ( p, current_dir, gix_path:: realpath:: MAX_SYMLINKS ) . ok ( )
278+ } else {
279+ gix_path:: normalize ( p. into ( ) , current_dir) . map ( Cow :: into_owned)
280+ }
281+ } )
276282 . is_some_and ( |config_path| config_path. starts_with ( git_dir) )
277283 }
278284 let worktree_path = config
@@ -305,9 +311,14 @@ impl ThreadSafeRepository {
305311 // the reason we use realpath instead of gix_path::normalize here is because there
306312 // could be any intermediate symlinks (for example due to a symlinked .git
307313 // directory)
308- worktree_dir = gix_path:: realpath ( & wt_path) . ok ( ) ;
309- // restore the relative path if possible after resolving the absolute path
310- if wt_path. is_relative ( ) {
314+ let is_relative = wt_path. is_relative ( ) ;
315+ worktree_dir = if wt_path. exists ( ) {
316+ gix_path:: realpath ( & wt_path) . ok ( )
317+ } else {
318+ Some ( wt_path. into_owned ( ) )
319+ } ;
320+ // restore the relative path if possible after resolving the absolute path
321+ if is_relative {
311322 if let Some ( rel_path) = worktree_dir. as_deref ( ) . and_then ( |p| p. strip_prefix ( current_dir) . ok ( ) ) {
312323 worktree_dir = Some ( rel_path. to_path_buf ( ) ) ;
313324 }
Original file line number Diff line number Diff line change @@ -310,27 +310,6 @@ mod index_worktree {
310310 ) ;
311311 }
312312
313- #[ test]
314- fn submodule_in_symlinked_dir ( ) -> crate :: Result {
315- use crate :: util:: named_subrepo_opts;
316- let repo = named_subrepo_opts (
317- "make_submodule_with_symlinked_git_dir.sh" ,
318- "symlinked-git-dir" ,
319- gix:: open:: Options :: isolated ( ) ,
320- ) ?;
321- let status = repo
322- . status ( gix:: progress:: Discard ) ?
323- . index_worktree_options_mut ( |opts| {
324- opts. sorting =
325- Some ( gix:: status:: plumbing:: index_as_worktree_with_renames:: Sorting :: ByPathCaseSensitive ) ;
326- } )
327- . into_index_worktree_iter ( None ) ?;
328- for change in status {
329- change?;
330- }
331- Ok ( ( ) )
332- }
333-
334313 #[ test]
335314 fn submodule_modification ( ) -> crate :: Result {
336315 let repo = submodule_repo ( "modified-untracked-and-submodule-head-changed-and-modified" ) ?;
You can’t perform that action at this time.
0 commit comments