-
Notifications
You must be signed in to change notification settings - Fork 899
Make sure treechanges and statuses are case-sensitive #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure treechanges and statuses are case-sensitive #365
Conversation
This is also related to #345. /cc @nulltoken @arrbee |
Tests look good to me. I'm confused why d9d866f is failing on |
Rebased on top of vNext. I moved |
{ | ||
public static class OdbHelper | ||
{ | ||
public static Blob CreateBlob(Repository repo, string content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't want to go down this path, but could this just be a test project extension method on ObjectDatabase
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be confusing for people who read Unit Tests to understand how to use the library? They could mistake this extension method for a real method exposed by LibGit2Sharp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
- Leave as-is?
CreateTestBlob()
?- Move the helper into the project proper, perhaps with an optional encoder? Could be handy for consumers, perhaps even in their own testing.
@yorah What's the status regarding this PR? |
The tests fail on Windows (works on Mono, but just because the test is skipped). I think for the same reason than #345 (or if not, something very closely related). I believe that the fixes needed to make those tests pass will come from libgit2, and I've been willing to write some failing C tests to open an issue about. Hopefully I will have time to do that soon. |
@arrbee's libgit2/libgit2#1499 partially fixes this PR (the diff tree to tree test is now passing, however the status retrieval is still inconsistent with git.git on Windows). git.git behaviour (with a breakpoint in
Test output
|
I just rebased this PR, and split it in two commits so that the first one can get merged. |
Awesome! dc208c9 has been merged. 👍 |
@yorah What should we do this one? |
ping? |
@yorah Thanks for the rebase. However, could you please just take care of fixing the following errors?
|
Fix proposal diff --git a/LibGit2Sharp.Tests/StatusFixture.cs b/LibGit2Sharp.Tests/StatusFixture.cs
index d818873..6bd172a 100644
--- a/LibGit2Sharp.Tests/StatusFixture.cs
+++ b/LibGit2Sharp.Tests/StatusFixture.cs
@@ -445,12 +445,12 @@ FileStatus expectedCamelCasedFileStatus
[SkippableFact]
public void RetrievingStatusMustAlwaysBeCaseSensitive()
{
- SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
-
InconclusiveIf(() => IsFileSystemCaseSensitive,
"Skipping 'ignorecase = true' test on case-sensitive file system.");
- using (Repository repo = Repository.Init(scd.DirectoryPath))
+ string repoPath = InitNewRepository();
+
+ using (Repository repo = new Repository(repoPath))
{
repo.Config.Set("core.ignorecase", true);
@@ -462,22 +462,23 @@ public void RetrievingStatusMustAlwaysBeCaseSensitive()
Tree treeOld = repo.ObjectDatabase.CreateTree(tdOld);
- var commit = repo.ObjectDatabase.CreateCommit("blah", DummySignature, DummySignature, treeOld, new Commit[] { });
+ var commit = repo.ObjectDatabase.CreateCommit(
+ Constants.Signature, Constants.Signature, "blah", treeOld, new Commit[] { }, true);
repo.Refs.Add("refs/heads/master", commit.Sha);
Assert.Equal(commit, repo.Head.Tip);
}
- using (var repo = new Repository(scd.DirectoryPath))
+ using (var repo = new Repository(repoPath))
{
File.WriteAllText(Path.Combine(repo.Info.WorkingDirectory, "a.TxT"), "blah\n");
- var status = repo.Index.RetrieveStatus();
+ var status = repo.RetrieveStatus();
- Assert.Equal(FileStatus.Removed, status["a.txt"]);
- Assert.Equal(FileStatus.Removed, status["A.TXT"]);
- Assert.Equal(FileStatus.Untracked, status["a.TxT"]);
+ Assert.Equal(FileStatus.Removed, status["a.txt"].State);
+ Assert.Equal(FileStatus.Removed, status["A.TXT"].State);
+ Assert.Equal(FileStatus.Untracked, status["a.TxT"].State);
}
} |
Still failing on Windows (and macosx). Test output a.txt is |
This behavior has been discussed in #344.