Skip to content

Commit 808c17b

Browse files
committed
Work around macOS File.Move problem
1 parent 9828971 commit 808c17b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

LibGit2Sharp.Tests/StatusFixture.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using System;
2+
using System.Diagnostics;
23
using System.IO;
34
using System.Linq;
45
using System.Text;
6+
using LibGit2Sharp.Core;
57
using LibGit2Sharp.Tests.TestHelpers;
68
using Xunit;
79
using Xunit.Extensions;
@@ -459,7 +461,16 @@ FileStatus expectedCamelCasedFileStatus
459461
const string upercasedFilename = "Plop";
460462

461463
string camelCasedPath = Path.Combine(repo.Info.WorkingDirectory, upercasedFilename);
462-
File.Move(lowerCasedPath, camelCasedPath);
464+
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+
}
463474

464475
Assert.Equal(expectedlowerCasedFileStatus, repo.RetrieveStatus(lowercasedFilename));
465476
Assert.Equal(expectedCamelCasedFileStatus, repo.RetrieveStatus(upercasedFilename));

0 commit comments

Comments
 (0)