blob: a5fadbb48a22ae186d15fa244c72a6ef4a9960fc (
plain)
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
|
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);
}
}
}
|