Skip to content

Commit c7152a6

Browse files
author
J Wyman
committed
Re-enabled the various sub-tests for the theories
Everthing works on Windows with `autocrlf` true or false
1 parent 7775f43 commit c7152a6

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

LibGit2Sharp.Tests/RebaseFixture.cs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,19 @@ int IEqualityComparer<CompletedRebaseStepInfo>.GetHashCode(CompletedRebaseStepIn
191191
/// Verify a single rebase, but in more detail.
192192
/// </summary>
193193
[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)
198200
{
199201
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
200202
var path = Repository.Init(scd.DirectoryPath);
201203

202204
using (Repository repo = new Repository(path))
203205
{
204-
ConstructRebaseTestRepository(repo, attributes);
206+
ConstructRebaseTestRepository(repo, attributes, lineEnding);
205207

206208
Branch initialBranch = repo.Branches[topicBranch1Name];
207209
Branch upstreamBranch = repo.Branches[masterBranch2Name];
@@ -595,16 +597,18 @@ public void CurrentStepInfoIsNullWhenNotRebasing()
595597
}
596598

597599
[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)
602606
{
603607
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
604608
var path = Repository.Init(scd.DirectoryPath);
605609
using (Repository repo = new Repository(path))
606610
{
607-
ConstructRebaseTestRepository(repo, attributes);
611+
ConstructRebaseTestRepository(repo, attributes, lineEnding);
608612

609613
repo.Checkout(topicBranch1Name);
610614

@@ -670,7 +674,7 @@ public void RebasingInBareRepositoryThrows()
670674
}
671675
}
672676

673-
private void ConstructRebaseTestRepository(Repository repo, string attributes = "* text=auto")
677+
private void ConstructRebaseTestRepository(Repository repo, string attributes = "* text=auto", string lineEnding = "\r\n")
674678
{
675679
// Constructs a graph that looks like:
676680
// * -- * -- * (modifications to c.txt)
@@ -725,29 +729,29 @@ private void ConstructRebaseTestRepository(Repository repo, string attributes =
725729

726730
Branch masterBranch1 = repo.CreateBranch(masterBranch1Name, commit);
727731

728-
Touch(workdir, filePathB, string.Join(Environment.NewLine, fileContentB1, fileContentB2));
732+
Touch(workdir, filePathB, string.Join(lineEnding, fileContentB1, fileContentB2));
729733
repo.Stage(filePathB);
730734
commit = repo.Commit("commit 4", Constants.Signature, Constants.Signature, new CommitOptions());
731735

732-
Touch(workdir, filePathB, string.Join(Environment.NewLine, fileContentB1, fileContentB2, fileContentB3));
736+
Touch(workdir, filePathB, string.Join(lineEnding, fileContentB1, fileContentB2, fileContentB3));
733737
repo.Stage(filePathB);
734738
commit = repo.Commit("commit 5", Constants.Signature, Constants.Signature, new CommitOptions());
735739

736-
Touch(workdir, filePathB, string.Join(Environment.NewLine, fileContentB1, fileContentB2, fileContentB3, fileContentB4));
740+
Touch(workdir, filePathB, string.Join(lineEnding, fileContentB1, fileContentB2, fileContentB3, fileContentB4));
737741
repo.Stage(filePathB);
738742
commit = repo.Commit("commit 6", Constants.Signature, Constants.Signature, new CommitOptions());
739743

740744
repo.CreateBranch(topicBranch1Name, commit);
741745

742-
Touch(workdir, filePathC, string.Join(Environment.NewLine, fileContentC1, fileContentC2));
746+
Touch(workdir, filePathC, string.Join(lineEnding, fileContentC1, fileContentC2));
743747
repo.Stage(filePathC);
744748
commit = repo.Commit("commit 7", Constants.Signature, Constants.Signature, new CommitOptions());
745749

746-
Touch(workdir, filePathC, string.Join(Environment.NewLine, fileContentC1, fileContentC2, fileContentC3));
750+
Touch(workdir, filePathC, string.Join(lineEnding, fileContentC1, fileContentC2, fileContentC3));
747751
repo.Stage(filePathC);
748752
commit = repo.Commit("commit 8", Constants.Signature, Constants.Signature, new CommitOptions());
749753

750-
Touch(workdir, filePathC, string.Join(Environment.NewLine, fileContentC1, fileContentC2, fileContentC3, fileContentC4));
754+
Touch(workdir, filePathC, string.Join(lineEnding, fileContentC1, fileContentC2, fileContentC3, fileContentC4));
751755
repo.Stage(filePathC);
752756
commit = repo.Commit("commit 9", Constants.Signature, Constants.Signature, new CommitOptions());
753757

@@ -758,18 +762,18 @@ private void ConstructRebaseTestRepository(Repository repo, string attributes =
758762
repo.Stage(filePathD);
759763
commit = repo.Commit("commit 10", Constants.Signature, Constants.Signature, new CommitOptions());
760764

761-
Touch(workdir, filePathD, string.Join(Environment.NewLine, fileContentD1, fileContentD2));
765+
Touch(workdir, filePathD, string.Join(lineEnding, fileContentD1, fileContentD2));
762766
repo.Stage(filePathD);
763767
commit = repo.Commit("commit 11", Constants.Signature, Constants.Signature, new CommitOptions());
764768

765-
Touch(workdir, filePathD, string.Join(Environment.NewLine, fileContentD1, fileContentD2, fileContentD3));
769+
Touch(workdir, filePathD, string.Join(lineEnding, fileContentD1, fileContentD2, fileContentD3));
766770
repo.Stage(filePathD);
767771
commit = repo.Commit("commit 12", Constants.Signature, Constants.Signature, new CommitOptions());
768772

769773
repo.CreateBranch(masterBranch2Name, commit);
770774

771775
// 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));
773777
repo.Stage(filePathB);
774778
commit = repo.Commit("commit 13", Constants.Signature, Constants.Signature, new CommitOptions());
775779
repo.CreateBranch(conflictBranch1Name, commit);

0 commit comments

Comments
 (0)