|
1 | 1 | using System; |
2 | | -using System.Diagnostics; |
3 | 2 | using System.IO; |
4 | 3 | using System.Linq; |
5 | 4 | using System.Text; |
6 | | -using LibGit2Sharp.Core; |
7 | 5 | using LibGit2Sharp.Tests.TestHelpers; |
8 | 6 | using Xunit; |
9 | 7 | using Xunit.Extensions; |
@@ -437,46 +435,41 @@ public void RetrievingTheStatusOfTheRepositoryHonorsTheGitIgnoreDirectives() |
437 | 435 | [InlineData(false, FileStatus.DeletedFromWorkdir, FileStatus.NewInWorkdir)] |
438 | 436 | public void RetrievingTheStatusOfAFilePathHonorsTheIgnoreCaseConfigurationSetting( |
439 | 437 | bool shouldIgnoreCase, |
440 | | - FileStatus expectedlowerCasedFileStatus, |
441 | | - FileStatus expectedCamelCasedFileStatus |
| 438 | + FileStatus expectedLowercaseFileStatus, |
| 439 | + FileStatus expectedUppercaseFileStatus |
442 | 440 | ) |
443 | 441 | { |
444 | | - string lowerCasedPath; |
445 | | - const string lowercasedFilename = "plop"; |
| 442 | + string lowercasePath; |
| 443 | + const string lowercaseFileName = "plop"; |
446 | 444 |
|
447 | 445 | string repoPath = InitNewRepository(); |
448 | 446 |
|
449 | 447 | using (var repo = new Repository(repoPath)) |
450 | 448 | { |
451 | 449 | repo.Config.Set("core.ignorecase", shouldIgnoreCase); |
452 | 450 |
|
453 | | - lowerCasedPath = Touch(repo.Info.WorkingDirectory, lowercasedFilename); |
| 451 | + lowercasePath = Touch(repo.Info.WorkingDirectory, lowercaseFileName); |
454 | 452 |
|
455 | | - Commands.Stage(repo, lowercasedFilename); |
| 453 | + Commands.Stage(repo, lowercaseFileName); |
456 | 454 | repo.Commit("initial", Constants.Signature, Constants.Signature); |
457 | 455 | } |
458 | 456 |
|
459 | 457 | using (var repo = new Repository(repoPath)) |
460 | 458 | { |
461 | | - const string upercasedFilename = "Plop"; |
| 459 | + const string uppercaseFileName = "PLOP"; |
462 | 460 |
|
463 | | - string camelCasedPath = Path.Combine(repo.Info.WorkingDirectory, upercasedFilename); |
| 461 | + string uppercasePath = Path.Combine(repo.Info.WorkingDirectory, uppercaseFileName); |
464 | 462 |
|
465 | | - if (Platform.OperatingSystem == OperatingSystemType.MacOSX) |
466 | | - { |
467 | | - var process = Process.Start("mv", $"{lowerCasedPath} {camelCasedPath}"); |
468 | | - process.WaitForExit(); |
469 | | - } |
470 | | - else |
471 | | - { |
472 | | - File.Move(lowerCasedPath, camelCasedPath); |
473 | | - } |
| 463 | + //Workaround for problem with .NET Core 1.x on macOS where going directly from lowercasePath to uppercasePath fails |
| 464 | + //https://github.com/dotnet/corefx/issues/18521 |
| 465 | + File.Move(lowercasePath, "__tmp__"); |
| 466 | + File.Move("__tmp__", uppercasePath); |
474 | 467 |
|
475 | | - Assert.Equal(expectedlowerCasedFileStatus, repo.RetrieveStatus(lowercasedFilename)); |
476 | | - Assert.Equal(expectedCamelCasedFileStatus, repo.RetrieveStatus(upercasedFilename)); |
| 468 | + Assert.Equal(expectedLowercaseFileStatus, repo.RetrieveStatus(lowercaseFileName)); |
| 469 | + Assert.Equal(expectedUppercaseFileStatus, repo.RetrieveStatus(uppercaseFileName)); |
477 | 470 |
|
478 | | - AssertStatus(shouldIgnoreCase, expectedlowerCasedFileStatus, repo, camelCasedPath.ToLowerInvariant()); |
479 | | - AssertStatus(shouldIgnoreCase, expectedCamelCasedFileStatus, repo, camelCasedPath.ToUpperInvariant()); |
| 471 | + AssertStatus(shouldIgnoreCase, expectedLowercaseFileStatus, repo, uppercasePath.ToLowerInvariant()); |
| 472 | + AssertStatus(shouldIgnoreCase, expectedUppercaseFileStatus, repo, uppercasePath.ToUpperInvariant()); |
480 | 473 | } |
481 | 474 | } |
482 | 475 |
|
|
0 commit comments