Skip to content

Commit 2b2d0f3

Browse files
committed
Fold most of ReferenceExtensions.cs into Reference.cs
1 parent ca14e7a commit 2b2d0f3

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

LibGit2Sharp/Reference.cs

+36
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,42 @@ public static bool IsValidName(string canonicalName)
8383
return Proxy.git_reference_is_valid_name(canonicalName);
8484
}
8585

86+
/// <summary>
87+
/// Determine if the current <see cref="Reference"/> is a local branch.
88+
/// </summary>
89+
/// <returns>true if the current <see cref="Reference"/> is a local branch, false otherwise.</returns>
90+
public virtual bool IsLocalBranch()
91+
{
92+
return CanonicalName.LooksLikeLocalBranch();
93+
}
94+
95+
/// <summary>
96+
/// Determine if the current <see cref="Reference"/> is a remote tracking branch.
97+
/// </summary>
98+
/// <returns>true if the current <see cref="Reference"/> is a remote tracking branch, false otherwise.</returns>
99+
public virtual bool IsRemoteTrackingBranch()
100+
{
101+
return CanonicalName.LooksLikeRemoteTrackingBranch();
102+
}
103+
104+
/// <summary>
105+
/// Determine if the current <see cref="Reference"/> is a tag.
106+
/// </summary>
107+
/// <returns>true if the current <see cref="Reference"/> is a tag, false otherwise.</returns>
108+
public virtual bool IsTag()
109+
{
110+
return CanonicalName.LooksLikeTag();
111+
}
112+
113+
/// <summary>
114+
/// Determine if the current <see cref="Reference"/> is a note.
115+
/// </summary>
116+
/// <returns>true if the current <see cref="Reference"/> is a note, false otherwise.</returns>
117+
public virtual bool IsNote()
118+
{
119+
return CanonicalName.LooksLikeNote();
120+
}
121+
86122
/// <summary>
87123
/// Gets the full name of this reference.
88124
/// </summary>

LibGit2Sharp/ReferenceExtensions.cs

+1-41
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace LibGit2Sharp
55
/// <summary>
66
/// Provides helpers to a <see cref="Reference"/>.
77
/// </summary>
8-
public static class ReferenceExtensions
8+
internal static class ReferenceExtensions
99
{
1010
internal static bool LooksLikeLocalBranch(this string canonicalName)
1111
{
@@ -31,45 +31,5 @@ private static bool IsPrefixedBy(this string input, string prefix)
3131
{
3232
return input.StartsWith(prefix, StringComparison.Ordinal);
3333
}
34-
35-
/// <summary>
36-
/// Determine if the current <see cref="Reference"/> is a local branch.
37-
/// </summary>
38-
/// <param name="reference">The <see cref="Reference"/> to test.</param>
39-
/// <returns>true if the current <see cref="Reference"/> is a local branch, false otherwise.</returns>
40-
public static bool IsLocalBranch(this Reference reference)
41-
{
42-
return reference.CanonicalName.LooksLikeLocalBranch();
43-
}
44-
45-
/// <summary>
46-
/// Determine if the current <see cref="Reference"/> is a remote tracking branch.
47-
/// </summary>
48-
/// <param name="reference">The <see cref="Reference"/> to test.</param>
49-
/// <returns>true if the current <see cref="Reference"/> is a remote tracking branch, false otherwise.</returns>
50-
public static bool IsRemoteTrackingBranch(this Reference reference)
51-
{
52-
return reference.CanonicalName.LooksLikeRemoteTrackingBranch();
53-
}
54-
55-
/// <summary>
56-
/// Determine if the current <see cref="Reference"/> is a tag.
57-
/// </summary>
58-
/// <param name="reference">The <see cref="Reference"/> to test.</param>
59-
/// <returns>true if the current <see cref="Reference"/> is a tag, false otherwise.</returns>
60-
public static bool IsTag(this Reference reference)
61-
{
62-
return reference.CanonicalName.LooksLikeTag();
63-
}
64-
65-
/// <summary>
66-
/// Determine if the current <see cref="Reference"/> is a note.
67-
/// </summary>
68-
/// <param name="reference">The <see cref="Reference"/> to test.</param>
69-
/// <returns>true if the current <see cref="Reference"/> is a note, false otherwise.</returns>
70-
public static bool IsNote(this Reference reference)
71-
{
72-
return reference.CanonicalName.LooksLikeNote();
73-
}
7434
}
7535
}

0 commit comments

Comments
 (0)