Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Turn repo.Tags string based overloads into extension methods

  • Loading branch information...
commit 9e590cb51223fe0c9d2d047ae6b8cdcfe81fa30b 1 parent b5270c4
@nulltoken nulltoken authored
View
17 LibGit2Sharp/TagCollection.cs
@@ -139,23 +139,12 @@ public virtual Tag Create(string name, string target, bool allowOverwrite = fals
/// <summary>
/// Deletes the tag with the specified name.
/// </summary>
- /// <param name = "name">The short or canonical name of the tag to delete.</param>
- public virtual void Remove(string name)
- {
- Ensure.ArgumentNotNullOrEmptyString(name, "name");
-
- Proxy.git_tag_delete(repo.Handle, UnCanonicalizeName(name));
- }
-
- /// <summary>
- /// Deletes the tag with the specified name.
- /// </summary>
/// <param name = "tag">The tag to delete.</param>
public virtual void Remove(Tag tag)
{
Ensure.ArgumentNotNull(tag, "tag");
- Remove(tag.CanonicalName);
+ this.Remove(tag.CanonicalName);
}
/// <summary>
@@ -165,7 +154,7 @@ public virtual void Remove(Tag tag)
[Obsolete("This method will be removed in the next release. Please use Remove() instead.")]
public virtual void Delete(string name)
{
- Remove(name);
+ this.Remove(name);
}
private static string NormalizeToCanonicalName(string name)
@@ -180,7 +169,7 @@ private static string NormalizeToCanonicalName(string name)
return string.Concat(refsTagsPrefix, name);
}
- private static string UnCanonicalizeName(string name)
+ internal string UnCanonicalizeName(string name)
{
Ensure.ArgumentNotNullOrEmptyString(name, "name");
View
12 LibGit2Sharp/TagCollectionExtensions.cs
@@ -40,5 +40,17 @@ public static Tag Add(this TagCollection tags, string name, string objectish, bo
return tags.Add(name, objectToTag, allowOverwrite);
}
+
+ /// <summary>
+ /// Deletes the tag with the specified name.
+ /// </summary>
+ /// <param name = "name">The short or canonical name of the tag to delete.</param>
+ /// <param name = "tags">The <see cref="TagCollection"/> being worked with.</param>
+ public static void Remove(this TagCollection tags, string name)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+
+ Proxy.git_tag_delete(tags.repo.Handle, tags.UnCanonicalizeName(name));
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.