-
Notifications
You must be signed in to change notification settings - Fork 892
/
Copy pathReferenceExtensions.cs
35 lines (30 loc) · 1.02 KB
/
ReferenceExtensions.cs
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
using System;
namespace LibGit2Sharp
{
/// <summary>
/// Provides helpers to a <see cref="Reference"/>.
/// </summary>
internal static class ReferenceExtensions
{
internal static bool LooksLikeLocalBranch(this string canonicalName)
{
return canonicalName.IsPrefixedBy(Reference.LocalBranchPrefix);
}
internal static bool LooksLikeRemoteTrackingBranch(this string canonicalName)
{
return canonicalName.IsPrefixedBy(Reference.RemoteTrackingBranchPrefix);
}
internal static bool LooksLikeTag(this string canonicalName)
{
return canonicalName.IsPrefixedBy(Reference.TagPrefix);
}
internal static bool LooksLikeNote(this string canonicalName)
{
return canonicalName.IsPrefixedBy(Reference.NotePrefix);
}
private static bool IsPrefixedBy(this string input, string prefix)
{
return input.StartsWith(prefix, StringComparison.Ordinal);
}
}
}