@@ -536,5 +536,63 @@ public void CanExcludeStatusOfFilesInSubmodule()
536536 Assert . Equal ( expected , status . Modified . Select ( x => x . FilePath ) . ToArray ( ) ) ;
537537 }
538538 }
539+
540+ [ Fact ]
541+ public void CanRetrieveTheStatusOfARelativeWorkingDirectory ( )
542+ {
543+ string path = CloneStandardTestRepo ( ) ;
544+ using ( var repo = new Repository ( path ) )
545+ {
546+ const string file = "just_a_dir/other.txt" ;
547+ const string otherFile = "just_a_dir/another_dir/other.txt" ;
548+
549+ Touch ( repo . Info . WorkingDirectory , file ) ;
550+ Touch ( repo . Info . WorkingDirectory , otherFile ) ;
551+
552+ RepositoryStatus status = repo . RetrieveStatus ( new StatusOptions ( ) { PathSpec = new [ ] { "just_a_dir" } } ) ;
553+ Assert . Equal ( 2 , status . Count ( ) ) ;
554+ Assert . Equal ( 2 , status . Untracked . Count ( ) ) ;
555+
556+ status = repo . RetrieveStatus ( new StatusOptions ( ) { PathSpec = new [ ] { "just_a_dir/another_dir" } } ) ;
557+ Assert . Equal ( 1 , status . Count ( ) ) ;
558+ Assert . Equal ( 1 , status . Untracked . Count ( ) ) ;
559+ }
560+ }
561+
562+ [ Fact ]
563+ public void CanRetrieveTheStatusOfMultiplePathSpec ( )
564+ {
565+ string path = CloneStandardTestRepo ( ) ;
566+ using ( var repo = new Repository ( path ) )
567+ {
568+ const string file = "just_a_dir/other.txt" ;
569+ const string otherFile = "just_a_file.txt" ;
570+
571+ Touch ( repo . Info . WorkingDirectory , file ) ;
572+ Touch ( repo . Info . WorkingDirectory , otherFile ) ;
573+
574+ RepositoryStatus status = repo . RetrieveStatus ( new StatusOptions ( ) { PathSpec = new [ ] { "just_a_file.txt" , "just_a_dir" } } ) ;
575+ Assert . Equal ( 2 , status . Count ( ) ) ;
576+ Assert . Equal ( 2 , status . Untracked . Count ( ) ) ;
577+ }
578+ }
579+
580+ [ Fact ]
581+ public void CanRetrieveTheStatusOfAGlobSpec ( )
582+ {
583+ string path = CloneStandardTestRepo ( ) ;
584+ using ( var repo = new Repository ( path ) )
585+ {
586+ const string file = "just_a_dir/other.txt" ;
587+ const string otherFile = "just_a_file.txt" ;
588+
589+ Touch ( repo . Info . WorkingDirectory , file ) ;
590+ Touch ( repo . Info . WorkingDirectory , otherFile ) ;
591+
592+ RepositoryStatus status = repo . RetrieveStatus ( new StatusOptions ( ) { PathSpec = new [ ] { "just_a_*" } } ) ;
593+ Assert . Equal ( 2 , status . Count ( ) ) ;
594+ Assert . Equal ( 2 , status . Untracked . Count ( ) ) ;
595+ }
596+ }
539597 }
540598}
0 commit comments