File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -490,6 +490,33 @@ public void CanUpdateIndexWhenNothingHappened()
490
490
}
491
491
}
492
492
493
+ [ Fact ]
494
+ public void IndexIsUpdatedAfterAddingFile ( )
495
+ {
496
+ const string fileName = "new-file.txt" ;
497
+
498
+ var path = SandboxAssumeUnchangedTestRepo ( ) ;
499
+ using ( var repo = new Repository ( path ) )
500
+ {
501
+ // create a file on disk
502
+ Touch ( repo . Info . WorkingDirectory , fileName , "hello test file\n " ) ;
503
+
504
+ repo . Index . Clear ( ) ;
505
+ repo . Index . Add ( fileName ) ;
506
+
507
+ var first = repo . Index [ fileName ] . Id ;
508
+
509
+ Touch ( repo . Info . WorkingDirectory , fileName , "rewrite the file\n " ) ;
510
+
511
+ repo . Index . Update ( ) ;
512
+
513
+ var second = repo . Index [ fileName ] . Id ;
514
+
515
+ Assert . NotEqual ( first , second ) ;
516
+ }
517
+ }
518
+
519
+
493
520
private static void AddSomeCornerCases ( Repository repo )
494
521
{
495
522
// Turn 1.txt into a directory in the Index
You can’t perform that action at this time.
0 commit comments