@@ -408,12 +408,12 @@ impl<'index> State<'_, 'index> {
408408 None => false ,
409409 } ;
410410
411- // Here we implement racy-git. See racy-git.txt in the git documentation for a detailed documentation.
411+ // We implement racy-git. See racy-git.txt in the git documentation for detailed documentation.
412412 //
413413 // A file is racy if:
414- // 1. its `mtime` is at or after the last index timestamp and its entry stat information
415- // matches the on-disk file but the file contents are actually modified
416- // 2. it's size is 0 (set after detecting a file was racy previously)
414+ // 1. Its `mtime` is at or after the last index timestamp and its entry stat information
415+ // matches the on-disk file, but the file contents are actually modified
416+ // 2. Its size is 0 (set after detecting a file was racy previously)
417417 //
418418 // The first case is detected below by checking the timestamp if the file is marked unmodified.
419419 // The second case is usually detected either because the on-disk file is not empty, hence
@@ -449,7 +449,16 @@ impl<'index> State<'_, 'index> {
449449 file_len : file_size_bytes,
450450 filter : & mut self . filter ,
451451 attr_stack : & mut self . attr_stack ,
452- options : self . options ,
452+ core_symlinks :
453+ // If this is legitimately a symlink, then pretend symlinks are enabled as the option seems stale.
454+ // Otherwise, respect the option.
455+ if metadata. is_symlink ( )
456+ && entry. mode . to_tree_entry_mode ( ) . map ( |m| m. kind ( ) ) == Some ( gix_object:: tree:: EntryKind :: Link )
457+ {
458+ true
459+ } else {
460+ self . options . fs . symlink
461+ } ,
453462 id : & entry. id ,
454463 objects,
455464 worktree_reads : self . worktree_reads ,
@@ -517,7 +526,7 @@ where
517526 entry : & ' a gix_index:: Entry ,
518527 filter : & ' a mut gix_filter:: Pipeline ,
519528 attr_stack : & ' a mut gix_worktree:: Stack ,
520- options : & ' a Options ,
529+ core_symlinks : bool ,
521530 id : & ' a gix_hash:: oid ,
522531 objects : Find ,
523532 worktree_bytes : & ' a AtomicU64 ,
@@ -545,7 +554,7 @@ where
545554 //
546555 let is_symlink = self . entry . mode == gix_index:: entry:: Mode :: SYMLINK ;
547556 // TODO: what to do about precompose unicode and ignore_case for symlinks
548- let out = if is_symlink && self . options . fs . symlink {
557+ let out = if is_symlink && self . core_symlinks {
549558 // conversion to bstr can never fail because symlinks are only used
550559 // on unix (by git) so no reason to use the try version here
551560 let symlink_path =
0 commit comments