|
3 | 3 | using System.Linq; |
4 | 4 | using LibGit2Sharp.Tests.TestHelpers; |
5 | 5 | using Xunit; |
| 6 | +using Xunit.Extensions; |
6 | 7 |
|
7 | 8 | namespace LibGit2Sharp.Tests |
8 | 9 | { |
@@ -259,5 +260,40 @@ public void RetrievingTheStatusOfAnAmbiguousFileThrows() |
259 | 260 | Assert.Throws<AmbiguousSpecificationException>(() => repo.Index.RetrieveStatus(relativePath)); |
260 | 261 | } |
261 | 262 | } |
| 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 | + } |
262 | 298 | } |
263 | 299 | } |
0 commit comments