Skip to content

Commit d22b99c

Browse files
committed
Enhance Index.RetrieveStatus() test coverage
Partially fix git-tfs/git-tfs#231
1 parent ec04a57 commit d22b99c

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

LibGit2Sharp.Tests/StatusFixture.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using LibGit2Sharp.Tests.TestHelpers;
55
using Xunit;
6+
using Xunit.Extensions;
67

78
namespace LibGit2Sharp.Tests
89
{
@@ -259,5 +260,40 @@ public void RetrievingTheStatusOfAnAmbiguousFileThrows()
259260
Assert.Throws<AmbiguousSpecificationException>(() => repo.Index.RetrieveStatus(relativePath));
260261
}
261262
}
263+
264+
[Theory]
265+
[InlineData(true, FileStatus.Unaltered, FileStatus.Unaltered)]
266+
[InlineData(false, FileStatus.Missing, FileStatus.Untracked)]
267+
public void RetrievingTheStatusOfAFilePathHonorsTheIgnoreCaseConfigurationSetting(
268+
bool shouldIgnoreCase,
269+
FileStatus expectedlowerCasedFileStatus,
270+
FileStatus expectedCamelCasedFileStatus
271+
)
272+
{
273+
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
274+
275+
string lowerCasedPath;
276+
277+
using (Repository repo = Repository.Init(scd.DirectoryPath))
278+
{
279+
repo.Config.Set("core.ignorecase", shouldIgnoreCase);
280+
281+
lowerCasedPath = Path.Combine(repo.Info.WorkingDirectory, "plop");
282+
283+
File.WriteAllText(lowerCasedPath, string.Empty);
284+
285+
repo.Index.Stage(lowerCasedPath);
286+
repo.Commit("initial", DummySignature, DummySignature);
287+
}
288+
289+
using (var repo = new Repository(scd.DirectoryPath))
290+
{
291+
string camelCasedPath = Path.Combine(repo.Info.WorkingDirectory, "Plop");
292+
File.Move(lowerCasedPath, camelCasedPath);
293+
294+
Assert.Equal(expectedlowerCasedFileStatus, repo.Index.RetrieveStatus("plop"));
295+
Assert.Equal(expectedCamelCasedFileStatus, repo.Index.RetrieveStatus("Plop"));
296+
}
297+
}
262298
}
263299
}

0 commit comments

Comments
 (0)