using LibGit2Sharp.Core; namespace LibGit2Sharp { /// /// Provides helper overloads to a . /// public static class TagCollectionExtensions { /// /// Creates an annotated tag with the specified name. /// /// The name. /// Revparse spec for the target object. /// The tagger. /// The message. /// The being worked with. public static Tag Add(this TagCollection tags, string name, string objectish, Signature tagger, string message) { return tags.Add(name, objectish, tagger, message, false); } /// /// Creates an annotated tag with the specified name. /// /// The name. /// Revparse spec for the target object. /// The tagger. /// The message. /// True to allow silent overwriting a potentially existing tag, false otherwise. /// The being worked with. public static Tag Add(this TagCollection tags, string name, string objectish, Signature tagger, string message, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(objectish, "target"); GitObject objectToTag = tags.repo.Lookup(objectish, GitObjectType.Any, LookUpOptions.ThrowWhenNoGitObjectHasBeenFound); return tags.Add(name, objectToTag, tagger, message, allowOverwrite); } /// /// Creates a lightweight tag with the specified name. /// /// The name. /// Revparse spec for the target object. /// The being worked with. public static Tag Add(this TagCollection tags, string name, string objectish) { return tags.Add(name, objectish, false); } /// /// Creates a lightweight tag with the specified name. /// /// The name. /// Revparse spec for the target object. /// True to allow silent overwriting a potentially existing tag, false otherwise. /// The being worked with. public static Tag Add(this TagCollection tags, string name, string objectish, bool allowOverwrite) { Ensure.ArgumentNotNullOrEmptyString(objectish, "objectish"); GitObject objectToTag = tags.repo.Lookup(objectish, GitObjectType.Any, LookUpOptions.ThrowWhenNoGitObjectHasBeenFound); return tags.Add(name, objectToTag, allowOverwrite); } /// /// Deletes the tag with the specified name. /// /// The short or canonical name of the tag to delete. /// The being worked with. public static void Remove(this TagCollection tags, string name) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); Proxy.git_tag_delete(tags.repo.Handle, TagCollection.UnCanonicalizeName(name)); } } }