@@ -592,5 +592,40 @@ public void RetrievingTheStatusHonorsAssumedUnchangedMarkedIndexEntries()
592
592
Assert . Equal ( "hello.txt" , status . Modified . Single ( ) . FilePath ) ;
593
593
}
594
594
}
595
+
596
+ [ Fact ]
597
+ public void CanHandleTwoStatusEntryChangesWithTheSamePath ( )
598
+ {
599
+ var path = InitNewRepository ( ) ;
600
+
601
+ using ( Repository repo = new Repository ( path ) )
602
+ {
603
+ Blob mainContent = OdbHelper . CreateBlob ( repo , "awesome content\n " ) ;
604
+ Blob linkContent = OdbHelper . CreateBlob ( repo , "../../objc/Nu.h" ) ;
605
+
606
+ const string filePath = "include/Nu/Nu.h" ;
607
+
608
+ var tdOld = new TreeDefinition ( )
609
+ . Add ( filePath , linkContent , Mode . SymbolicLink )
610
+ . Add ( "objc/Nu.h" , mainContent , Mode . NonExecutableFile ) ;
611
+
612
+ Tree tree = repo . ObjectDatabase . CreateTree ( tdOld ) ;
613
+
614
+ Commit commit = repo . ObjectDatabase . CreateCommit ( Constants . Signature , Constants . Signature , "A symlink" , tree , Enumerable . Empty < Commit > ( ) , false ) ;
615
+ repo . Refs . UpdateTarget ( "HEAD" , commit . Id . Sha ) ;
616
+ repo . Reset ( ResetMode . Mixed ) ;
617
+
618
+ string parentPath = Path . Combine ( repo . Info . WorkingDirectory , "include/Nu" ) ;
619
+
620
+ Touch ( parentPath , "Nu.h" , "awesome content\n " ) ;
621
+
622
+ RepositoryStatus status = repo . RetrieveStatus (
623
+ new StatusOptions { DetectRenamesInIndex = true , DetectRenamesInWorkDir = true } ) ;
624
+
625
+ Assert . Equal ( 2 , status . Count ( ) ) ;
626
+ Assert . Equal ( Path . Combine ( "include" , "Nu" , "Nu.h" ) , status . Modified . Single ( ) . FilePath ) ;
627
+ Assert . Equal ( Path . Combine ( "objc" , "Nu.h" ) , status . Missing . Single ( ) . FilePath ) ;
628
+ }
629
+ }
595
630
}
596
631
}
0 commit comments