@@ -191,17 +191,19 @@ int IEqualityComparer<CompletedRebaseStepInfo>.GetHashCode(CompletedRebaseStepIn
191
191
/// Verify a single rebase, but in more detail.
192
192
/// </summary>
193
193
[ Theory ]
194
- [ InlineData ( "* text=auto" , new [ ] { "2cad6e96a0028f1764dcbde6292a9a1471acb114" , "18fd3deebe6124b5dacc8426d589d617a968e8d1" , "048977d8cb90d530e83cc615a17a49f3068f68c1" } ) ]
195
- //[InlineData("* text=lf", new[] { "4f813f70525a6ba4ea414a54ad89412b8d9f25aa", "6a2261c0739058ac987f1fa0014946753161b167", "6aa53c88fc1e739678749dff5acf4b00799b5c4d" })]
196
- //[InlineData("* text=crlf", new[] { "28e48a7c129e1025d0233cb5a92425f12f55070b", "d737950e62ec31a25afc34b06075e144b3d2be31", "bf4ed0456e4a2cc42a8746191501d8521cfad6a8" })]
197
- public void VerifyRebaseDetailed ( string attributes , string [ ] expectedIds )
194
+ [ InlineData ( "* text=auto" , "\r \n " , new [ ] { "2cad6e96a0028f1764dcbde6292a9a1471acb114" , "18fd3deebe6124b5dacc8426d589d617a968e8d1" , "048977d8cb90d530e83cc615a17a49f3068f68c1" } ) ]
195
+ [ InlineData ( "* text=auto\n *.txt eol=lf" , "\n " , new [ ] { "577d176b00a55e88e9b34da87e4357dfc9a486fd" , "ea0ad4d8b500394a61874ebfda5904376e2b1098" , "521b8383ca3fde9e369587492e7a3945677f1b2c" } ) ]
196
+ [ InlineData ( "* text=auto\r \n *.txt eol=crlf" , "\r \n " , new [ ] { "67d29fdf654ac4773c9405ab4b54aa7ff092f339" , "7b70c02e175d378b44ea28aeeece775cd972047a" , "81f203dbfe00a5c1ecd9c0e6b03705e6cffda5c0" } ) ]
197
+ [ InlineData ( "* binary" , "\r \n " , new [ ] { "f5a5ded935597108709224170accddc5aeb5c287" , "518adb8bb1ea1058d1825d3fe08d27f80c0e829b" , "d2db503ab553c970d34e1b5e3ff68768adef05bc" } ) ]
198
+ [ InlineData ( "* binary" , "\n " , new [ ] { "93a0e9680246d1f1e43fbd5308f7936424d9e81a" , "5fd40bffbdd884632c330a254a2bd1dfaaaad3c1" , "4df5c91b2d8318781b07d04f6bfa77304c372f1e" } ) ]
199
+ public void VerifyRebaseDetailed ( string attributes , string lineEnding , string [ ] expectedIds )
198
200
{
199
201
SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
200
202
var path = Repository . Init ( scd . DirectoryPath ) ;
201
203
202
204
using ( Repository repo = new Repository ( path ) )
203
205
{
204
- ConstructRebaseTestRepository ( repo , attributes ) ;
206
+ ConstructRebaseTestRepository ( repo , attributes , lineEnding ) ;
205
207
206
208
Branch initialBranch = repo . Branches [ topicBranch1Name ] ;
207
209
Branch upstreamBranch = repo . Branches [ masterBranch2Name ] ;
@@ -595,16 +597,18 @@ public void CurrentStepInfoIsNullWhenNotRebasing()
595
597
}
596
598
597
599
[ Theory ]
598
- [ InlineData ( "* text=auto" , "379e80ed7824be7672e1e30ddd8f44aa081d57d4" ) ]
599
- //[InlineData("* text=lf", "d43f4f2cb680ea446aef98f650a391224b18d171")]
600
- //[InlineData("* text=crlf", "62b1e8ddefb3a083f3c6bbda138271b878c59459")]
601
- public void CanRebaseHandlePatchAlreadyApplied ( string attributes , string expectedShaText )
600
+ [ InlineData ( "* text=auto" , "\r \n " , "379e80ed7824be7672e1e30ddd8f44aa081d57d4" ) ]
601
+ [ InlineData ( "* text=auto\n *.txt eol=lf" , "\n " , "94121eeebf7cfe0acf22425eab36fcdc737132b6" ) ]
602
+ [ InlineData ( "* text=auto\r \n *.txt eol=crlf" , "\r \n " , "dad06142cc632aea81cbc8486583011c4d622580" ) ]
603
+ [ InlineData ( "* binary" , "\r \n " , "44492d98b725189cfc0203d4192dfbb1fd34bf02" ) ]
604
+ [ InlineData ( "* binary" , "\n " , "f4b5b95de77f4cd97b4728617bae2dd8ba9af914" ) ]
605
+ public void CanRebaseHandlePatchAlreadyApplied ( string attributes , string lineEnding , string expectedShaText )
602
606
{
603
607
SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
604
608
var path = Repository . Init ( scd . DirectoryPath ) ;
605
609
using ( Repository repo = new Repository ( path ) )
606
610
{
607
- ConstructRebaseTestRepository ( repo , attributes ) ;
611
+ ConstructRebaseTestRepository ( repo , attributes , lineEnding ) ;
608
612
609
613
repo . Checkout ( topicBranch1Name ) ;
610
614
@@ -670,7 +674,7 @@ public void RebasingInBareRepositoryThrows()
670
674
}
671
675
}
672
676
673
- private void ConstructRebaseTestRepository ( Repository repo , string attributes = "* text=auto" )
677
+ private void ConstructRebaseTestRepository ( Repository repo , string attributes = "* text=auto" , string lineEnding = " \r \n " )
674
678
{
675
679
// Constructs a graph that looks like:
676
680
// * -- * -- * (modifications to c.txt)
@@ -725,29 +729,29 @@ private void ConstructRebaseTestRepository(Repository repo, string attributes =
725
729
726
730
Branch masterBranch1 = repo . CreateBranch ( masterBranch1Name , commit ) ;
727
731
728
- Touch ( workdir , filePathB , string . Join ( Environment . NewLine , fileContentB1 , fileContentB2 ) ) ;
732
+ Touch ( workdir , filePathB , string . Join ( lineEnding , fileContentB1 , fileContentB2 ) ) ;
729
733
repo . Stage ( filePathB ) ;
730
734
commit = repo . Commit ( "commit 4" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
731
735
732
- Touch ( workdir , filePathB , string . Join ( Environment . NewLine , fileContentB1 , fileContentB2 , fileContentB3 ) ) ;
736
+ Touch ( workdir , filePathB , string . Join ( lineEnding , fileContentB1 , fileContentB2 , fileContentB3 ) ) ;
733
737
repo . Stage ( filePathB ) ;
734
738
commit = repo . Commit ( "commit 5" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
735
739
736
- Touch ( workdir , filePathB , string . Join ( Environment . NewLine , fileContentB1 , fileContentB2 , fileContentB3 , fileContentB4 ) ) ;
740
+ Touch ( workdir , filePathB , string . Join ( lineEnding , fileContentB1 , fileContentB2 , fileContentB3 , fileContentB4 ) ) ;
737
741
repo . Stage ( filePathB ) ;
738
742
commit = repo . Commit ( "commit 6" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
739
743
740
744
repo . CreateBranch ( topicBranch1Name , commit ) ;
741
745
742
- Touch ( workdir , filePathC , string . Join ( Environment . NewLine , fileContentC1 , fileContentC2 ) ) ;
746
+ Touch ( workdir , filePathC , string . Join ( lineEnding , fileContentC1 , fileContentC2 ) ) ;
743
747
repo . Stage ( filePathC ) ;
744
748
commit = repo . Commit ( "commit 7" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
745
749
746
- Touch ( workdir , filePathC , string . Join ( Environment . NewLine , fileContentC1 , fileContentC2 , fileContentC3 ) ) ;
750
+ Touch ( workdir , filePathC , string . Join ( lineEnding , fileContentC1 , fileContentC2 , fileContentC3 ) ) ;
747
751
repo . Stage ( filePathC ) ;
748
752
commit = repo . Commit ( "commit 8" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
749
753
750
- Touch ( workdir , filePathC , string . Join ( Environment . NewLine , fileContentC1 , fileContentC2 , fileContentC3 , fileContentC4 ) ) ;
754
+ Touch ( workdir , filePathC , string . Join ( lineEnding , fileContentC1 , fileContentC2 , fileContentC3 , fileContentC4 ) ) ;
751
755
repo . Stage ( filePathC ) ;
752
756
commit = repo . Commit ( "commit 9" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
753
757
@@ -758,18 +762,18 @@ private void ConstructRebaseTestRepository(Repository repo, string attributes =
758
762
repo . Stage ( filePathD ) ;
759
763
commit = repo . Commit ( "commit 10" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
760
764
761
- Touch ( workdir , filePathD , string . Join ( Environment . NewLine , fileContentD1 , fileContentD2 ) ) ;
765
+ Touch ( workdir , filePathD , string . Join ( lineEnding , fileContentD1 , fileContentD2 ) ) ;
762
766
repo . Stage ( filePathD ) ;
763
767
commit = repo . Commit ( "commit 11" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
764
768
765
- Touch ( workdir , filePathD , string . Join ( Environment . NewLine , fileContentD1 , fileContentD2 , fileContentD3 ) ) ;
769
+ Touch ( workdir , filePathD , string . Join ( lineEnding , fileContentD1 , fileContentD2 , fileContentD3 ) ) ;
766
770
repo . Stage ( filePathD ) ;
767
771
commit = repo . Commit ( "commit 12" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
768
772
769
773
repo . CreateBranch ( masterBranch2Name , commit ) ;
770
774
771
775
// Create commit / branch that conflicts with T1 and T2
772
- Touch ( workdir , filePathB , string . Join ( Environment . NewLine , fileContentB1 , fileContentB2 + fileContentB3 + fileContentB4 ) ) ;
776
+ Touch ( workdir , filePathB , string . Join ( lineEnding , fileContentB1 , fileContentB2 + fileContentB3 + fileContentB4 ) ) ;
773
777
repo . Stage ( filePathB ) ;
774
778
commit = repo . Commit ( "commit 13" , Constants . Signature , Constants . Signature , new CommitOptions ( ) ) ;
775
779
repo . CreateBranch ( conflictBranch1Name , commit ) ;
0 commit comments