@@ -4574,34 +4574,38 @@ fn in_repo_hidden_worktree() -> crate::Result {
4574
4574
"if worktree information isn't provided, they would not be discovered in hidden directories"
4575
4575
) ;
4576
4576
4577
- let ( ( out, _root) , entries) = collect ( & root, None , |keep, ctx| {
4578
- walk (
4579
- & root,
4580
- ctx,
4581
- walk:: Options {
4582
- worktree_relative_worktree_dirs : Some ( & BTreeSet :: from ( [ "hidden/subdir/worktree" . into ( ) ] ) ) ,
4583
- ..options_emit_all ( )
4584
- } ,
4585
- keep,
4586
- )
4587
- } ) ;
4588
- assert_eq ! (
4589
- out,
4590
- walk:: Outcome {
4591
- read_dir_calls: 2 ,
4592
- returned_entries: entries. len( ) ,
4593
- seen_entries: 4 ,
4594
- }
4595
- ) ;
4596
- assert_eq ! (
4597
- entries,
4598
- & [
4599
- entry_nokind( ".git" , Pruned ) . with_property( DotGit ) . with_match( Always ) ,
4600
- entry( ".gitignore" , Untracked , File ) ,
4601
- entry( "dir/file" , Tracked , File ) ,
4602
- entry( "hidden" , Ignored ( Expendable ) , Directory ) ,
4603
- ] ,
4604
- "Currently, worktrees can't be found in ignored directories, even though hit should"
4605
- ) ;
4577
+ for ignored_emission_mode in [ Matching , CollapseDirectory ] {
4578
+ let ( ( out, _root) , entries) = collect ( & root, None , |keep, ctx| {
4579
+ walk (
4580
+ & root,
4581
+ ctx,
4582
+ walk:: Options {
4583
+ emit_ignored : Some ( ignored_emission_mode) ,
4584
+ worktree_relative_worktree_dirs : Some ( & BTreeSet :: from ( [ "hidden/subdir/worktree" . into ( ) ] ) ) ,
4585
+ ..options_emit_all ( )
4586
+ } ,
4587
+ keep,
4588
+ )
4589
+ } ) ;
4590
+ assert_eq ! (
4591
+ out,
4592
+ walk:: Outcome {
4593
+ read_dir_calls: 4 ,
4594
+ returned_entries: entries. len( ) ,
4595
+ seen_entries: 5 ,
4596
+ }
4597
+ ) ;
4598
+ assert_eq ! (
4599
+ entries,
4600
+ & [
4601
+ entry_nokind( ".git" , Pruned ) . with_property( DotGit ) . with_match( Always ) ,
4602
+ entry( ".gitignore" , Untracked , File ) ,
4603
+ entry( "dir/file" , Tracked , File ) ,
4604
+ entry( "hidden/file" , Ignored ( Expendable ) , File ) ,
4605
+ entry( "hidden/subdir/worktree" , Tracked , Repository ) . no_index_kind( ) ,
4606
+ ] ,
4607
+ "Worktrees within hidden directories are also detected and protected by counting them as tracked (like submodules)"
4608
+ ) ;
4609
+ }
4606
4610
Ok ( ( ) )
4607
4611
}
0 commit comments