Skip to content

Commit b73c9ef

Browse files
author
J Wyman
committed
Fixes RebaseFixture tests by adding .gitattributes file to repo
1 parent 2587d57 commit b73c9ef

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

LibGit2Sharp.Tests/FilterFixture.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ private unsafe bool CharArrayAreEqual(char[] array1, char[] array2, int count)
304304
return true;
305305
}
306306

307-
308307
private FileInfo CheckoutFileForSmudge(string repoPath, string branchName, string content)
309308
{
310309
FileInfo expectedPath;
@@ -350,11 +349,6 @@ private Repository CreateTestRepository(string path)
350349
return repository;
351350
}
352351

353-
private static void CreateAttributesFile(IRepository repo, string attributeEntry)
354-
{
355-
Touch(repo.Info.WorkingDirectory, ".gitattributes", attributeEntry);
356-
}
357-
358352
class EmptyFilter : Filter
359353
{
360354
public EmptyFilter(string name, IEnumerable<FilterAttributeEntry> attributes)

LibGit2Sharp.Tests/RebaseFixture.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ public void VerifyRebaseDetailed()
262262

263263
List<ObjectId> expectedTreeIds = new List<ObjectId>()
264264
{
265-
new ObjectId("447bad85bcc1882037848370620a6f88e8ee264e"),
266-
new ObjectId("3b0fc846952496a64b6149064cde21215daca8f8"),
267-
new ObjectId("a2d114246012daf3ef8e7ccbfbe91889a24e1e60"),
265+
new ObjectId("2cad6e96a0028f1764dcbde6292a9a1471acb114"),
266+
new ObjectId("18fd3deebe6124b5dacc8426d589d617a968e8d1"),
267+
new ObjectId("048977d8cb90d530e83cc615a17a49f3068f68c1"),
268268
};
269269

270270
List<Commit> rebasedCommits = repo.Commits.QueryBy(commitFilter).ToList();
@@ -602,7 +602,7 @@ public void CanRebaseHandlePatchAlreadyApplied()
602602

603603
repo.Checkout(topicBranch1Name);
604604

605-
Branch topicBranch1Prime = repo.CreateBranch(topicBranch1PrimeName, masterBranch1Name);
605+
Branch topicBranch1Prime = repo.CreateBranch(topicBranch1PrimeName, masterBranch1Name);
606606

607607
string newFileRelativePath = "new_file.txt";
608608
Touch(repo.Info.WorkingDirectory, newFileRelativePath, "New Content");
@@ -631,7 +631,7 @@ public void CanRebaseHandlePatchAlreadyApplied()
631631
};
632632

633633
repo.Rebase.Start(null, upstreamBranch, null, Constants.Identity2, options);
634-
ObjectId secondCommitExpectedTreeId = new ObjectId("ac04bf04980c9be72f64ba77fd0d9088a40ed681");
634+
ObjectId secondCommitExpectedTreeId = new ObjectId("379e80ed7824be7672e1e30ddd8f44aa081d57d4");
635635
Signature secondCommitAuthorSignature = Constants.Signature;
636636
Identity secondCommitCommiterIdentity = Constants.Identity2;
637637

@@ -700,6 +700,11 @@ private void ConstructRebaseTestRepository(Repository repo)
700700
string workdir = repo.Info.WorkingDirectory;
701701
Commit commit = null;
702702

703+
CreateAttributesFile(repo, "* text=auto");
704+
705+
repo.Stage(".gitattributes");
706+
commit = repo.Commit("setup", Constants.Signature, Constants.Signature, new CommitOptions());
707+
703708
Touch(workdir, filePathA, fileContentA1);
704709
repo.Stage(filePathA);
705710
commit = repo.Commit("commit 1", Constants.Signature, Constants.Signature, new CommitOptions());

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static BaseFixture()
4949
protected static DateTimeOffset TruncateSubSeconds(DateTimeOffset dto)
5050
{
5151
int seconds = dto.ToSecondsSinceEpoch();
52-
return Epoch.ToDateTimeOffset(seconds, (int) dto.Offset.TotalMinutes);
52+
return Epoch.ToDateTimeOffset(seconds, (int)dto.Offset.TotalMinutes);
5353
}
5454

5555
private static void SetUpTestEnvironment()
@@ -258,7 +258,7 @@ protected void RequiresDotNetOrMonoGreaterThanOrEqualTo(System.Version minimumVe
258258
throw new InvalidOperationException("Cannot access Mono.RunTime.GetDisplayName() method.");
259259
}
260260

261-
var version = (string) displayName.Invoke(null, null);
261+
var version = (string)displayName.Invoke(null, null);
262262

263263
System.Version current;
264264

@@ -460,5 +460,10 @@ public void AssertBelongsToARepository<T>(IRepository repo, T instance)
460460
{
461461
Assert.Same(repo, ((IBelongToARepository)instance).Repository);
462462
}
463+
464+
protected void CreateAttributesFile(IRepository repo, string attributeEntry)
465+
{
466+
Touch(repo.Info.WorkingDirectory, ".gitattributes", attributeEntry);
467+
}
463468
}
464469
}

0 commit comments

Comments
 (0)