forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathCase.cs
More file actions
37 lines (32 loc) · 1000 Bytes
/
PathCase.cs
File metadata and controls
37 lines (32 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
namespace LibGit2Sharp.Core
{
internal class PathCase
{
private readonly StringComparer comparer;
private readonly StringComparison comparison;
public PathCase(IRepository repo)
{
var value = repo.Config.Get<bool>("core.ignorecase");
switch (value != null && value.Value)
{
case true:
comparer = StringComparer.OrdinalIgnoreCase;
comparison = StringComparison.OrdinalIgnoreCase;
break;
default:
comparer = StringComparer.Ordinal;
comparison = StringComparison.Ordinal;
break;
}
}
public StringComparer Comparer
{
get { return comparer; }
}
public bool StartsWith(string path, string value)
{
return path != null && path.StartsWith(value, comparison);
}
}
}