8000 Introduce IsFileSystemCaseSensitive test helper · repo-archive/libgit2sharp@fb13e4e · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fb13e4e

Browse files
committed
Introduce IsFileSystemCaseSensitive test helper
1 parent 023eaf4 commit fb13e4e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ static BaseFixture()
2727

2828
public static readonly Signature DummySignature = new Signature("Author N. Ame", "him@there.com", TruncateSubSeconds(DateTimeOffset.Now));
2929

30+
public static bool IsFileSystemCaseSensitive { get; private set; }
31+
3032
protected static DateTimeOffset TruncateSubSeconds(DateTimeOffset dto)
3133
{
3234
int seconds = dto.ToSecondsSinceEpoch();
@@ -35,6 +37,8 @@ protected static DateTimeOffset TruncateSubSeconds(DateTimeOffset dto)
3537

3638
private static void SetUpTestEnvironment()
3739
{
40+
IsFileSystemCaseSensitive = IsFileSystemCaseSensitiveInternal();
41+
3842
var source = new DirectoryInfo(@"../../Resources");
3943
ResourcesDirectory = new DirectoryInfo(string.Format(@"Resources/{0}", Guid.NewGuid()));
4044
var parent = new DirectoryInfo(@"Resources");
@@ -54,6 +58,23 @@ private static void SetUpTestEnvironment()
5458
SubmoduleTestRepoWorkingDirPath = Path.Combine(ResourcesDirectory.FullName, "submodule_wd");
5559
}
5660

61+
private static bool IsFileSystemCaseSensitiveInternal()
62+
{
63+
var mixedPath = Path.Combine(Constants.TemporaryReposPath, "mIxEdCase");
64+
65+
if (Directory.Exists(mixedPath))
66+
{
67+
Directory.Delete(mixedPath);
68+
}
69+
70+
Directory.CreateDirectory(mixedPath);
71+
bool isInsensitive = Directory.Exists(mixedPath.ToLowerInvariant());
72+
73+
Directory.Delete(mixedPath);
74+
75+
return !isInsensitive;
76+
}
77+
5778
protected void CreateCorruptedDeadBeefHead(string repoPath)
5879
{
5980
const string deadbeef = "deadbeef";

0 commit comments

Comments
 (0)
0