@@ -488,125 +488,6 @@ public void RemovingAInvalidFileThrows(string filepath)
488
488
}
489
489
}
490
490
491
- [ Test ]
492
- public void CanRetrieveTheStatusOfAFile ( )
493
- {
494
- using ( var repo = new Repository ( StandardTestRepoPath ) )
495
- {
496
- FileStatus status = repo . Index . RetrieveStatus ( "new_tracked_file.txt" ) ;
497
- status . ShouldEqual ( FileStatus . Added ) ;
498
- }
499
- }
500
-
501
- [ Test ]
502
- public void RetrievingTheStatusOfADirectoryThrows ( )
503
- {
504
- using ( var repo = new Repository ( StandardTestRepoPath ) )
505
- {
506
- Assert . Throws < LibGit2Exception > ( ( ) => { FileStatus status = repo . Index . RetrieveStatus ( "1" ) ; } ) ;
507
- }
508
- }
509
-
510
- [ Test ]
511
- public void CanRetrieveTheStatusOfTheWholeWorkingDirectory ( )
512
- {
513
- TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo ( StandardTestRepoWorkingDirPath ) ;
514
- using ( var repo = new Repository ( path . RepositoryPath ) )
515
- {
516
- const string file = "modified_staged_file.txt" ;
517
-
518
- RepositoryStatus status = repo . Index . RetrieveStatus ( ) ;
519
-
520
- IndexEntry indexEntry = repo . Index [ file ] ;
521
- indexEntry . State . ShouldEqual ( FileStatus . Staged ) ;
522
-
523
- status . ShouldNotBeNull ( ) ;
524
- status . Count ( ) . ShouldEqual ( 6 ) ;
525
- status . IsDirty . ShouldBeTrue ( ) ;
526
-
527
- status . Untracked . Single ( ) . ShouldEqual ( "new_untracked_file.txt" ) ;
528
- status . Modified . Single ( ) . ShouldEqual ( "modified_unstaged_file.txt" ) ;
529
- status . Missing . Single ( ) . ShouldEqual ( "deleted_unstaged_file.txt" ) ;
530
- status . Added . Single ( ) . ShouldEqual ( "new_tracked_file.txt" ) ;
531
- status . Staged . Single ( ) . ShouldEqual ( file ) ;
532
- status . Removed . Single ( ) . ShouldEqual ( "deleted_staged_file.txt" ) ;
533
-
534
- File . AppendAllText ( Path . Combine ( repo . Info . WorkingDirectory , file ) ,
535
- "Tclem's favorite commit message: boom" ) ;
536
-
537
- indexEntry . State . ShouldEqual ( FileStatus . Staged | FileStatus . Modified ) ;
538
-
539
- RepositoryStatus status2 = repo . Index . RetrieveStatus ( ) ;
540
-
541
- status2 . ShouldNotBeNull ( ) ;
542
- status2 . Count ( ) . ShouldEqual ( 6 ) ;
543
- status2 . IsDirty . ShouldBeTrue ( ) ;
544
-
545
- status2 . Untracked . Single ( ) . ShouldEqual ( "new_untracked_file.txt" ) ;
546
- CollectionAssert . AreEqual ( new [ ] { file , "modified_unstaged_file.txt" } , status2 . Modified ) ;
547
- status2 . Missing . Single ( ) . ShouldEqual ( "deleted_unstaged_file.txt" ) ;
548
- status2 . Added . Single ( ) . ShouldEqual ( "new_tracked_file.txt" ) ;
549
- status2 . Staged . Single ( ) . ShouldEqual ( file ) ;
550
- status2 . Removed . Single ( ) . ShouldEqual ( "deleted_staged_file.txt" ) ;
551
- }
552
- }
553
-
554
- [ Test ]
555
- public void CanRetrieveTheStatusOfANewRepository ( )
556
- {
557
- SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
558
-
559
- using ( var repo = Repository . Init ( scd . DirectoryPath ) )
560
- {
561
- RepositoryStatus status = repo . Index . RetrieveStatus ( ) ;
562
- status . ShouldNotBeNull ( ) ;
563
- status . Count ( ) . ShouldEqual ( 0 ) ;
564
- status . IsDirty . ShouldBeFalse ( ) ;
565
-
566
- status . Untracked . Count ( ) . ShouldEqual ( 0 ) ;
567
- status . Modified . Count ( ) . ShouldEqual ( 0 ) ;
568
- status . Missing . Count ( ) . ShouldEqual ( 0 ) ;
569
- status . Added . Count ( ) . ShouldEqual ( 0 ) ;
570
- status . Staged . Count ( ) . ShouldEqual ( 0 ) ;
571
- status . Removed . Count ( ) . ShouldEqual ( 0 ) ;
572
- }
573
- }
574
-
575
- [ Test ]
576
- public void RetrievingTheStatusOfARepositoryReturnNativeFilePaths ( )
577
- {
578
- // Initialize a new repository
579
- SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
580
-
581
- const string directoryName = "directory" ;
582
- const string fileName = "Testfile.txt" ;
583
-
584
- // Create a file and insert some content
585
- string directoryPath = Path . Combine ( scd . RootedDirectoryPath , directoryName ) ;
586
- string filePath = Path . Combine ( directoryPath , fileName ) ;
587
-
588
- Directory . CreateDirectory ( directoryPath ) ;
589
- File . WriteAllText ( filePath , "Anybody out there?" ) ;
590
-
591
- // Open the repository
592
- using ( var repo = Repository . Init ( scd . DirectoryPath ) )
593
- {
594
- // Add the file to the index
595
- repo . Index . Stage ( filePath ) ;
596
-
597
- // Get the repository status
598
- RepositoryStatus repoStatus = repo . Index . RetrieveStatus ( ) ;
599
-
600
- repoStatus . Count ( ) . ShouldEqual ( 1 ) ;
601
- var statusEntry = repoStatus . Single ( ) ;
602
-
603
- string expectedPath = string . Format ( "{0}{1}{2}" , directoryName , Path . DirectorySeparatorChar , fileName ) ;
604
- statusEntry . FilePath . ShouldEqual ( expectedPath ) ;
605
-
606
- repoStatus . Added . Single ( ) . ShouldEqual ( statusEntry . FilePath ) ;
607
- }
608
- }
609
-
610
491
[ Test ]
611
492
public void PathsOfIndexEntriesAreExpressedInNativeFormat ( )
612
493
{
0 commit comments