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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
using LibGit2Sharp.Core;
namespace LibGit2Sharp
{
/// <summary>
/// Provides helper overloads to a <see cref="TagCollection"/>.
/// </summary>
public static class TagCollectionExtensions
{
/// <summary>
/// Creates an annotated tag with the specified name.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="objectish">Revparse spec for the target object.</param>
/// <param name="tagger">The tagger.</param>
/// <param name="message">The message.</param>
/// <param name="tags">The <see cref="TagCollection"/> being worked with.</param>
public static Tag Add(this TagCollection tags, string name, string objectish, Signature tagger, string message)
{
return tags.Add(name, objectish, tagger, message, false);
}
/// <summary>
/// Creates an annotated tag with the specified name.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="objectish">Revparse spec for the target object.</param>
/// <param name="tagger">The tagger.</param>
/// <param name="message">The message.</param>
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
/// <param name="tags">The <see cref="TagCollection"/> being worked with.</param>
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);
}
/// <summary>
/// Creates a lightweight tag with the specified name.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="objectish">Revparse spec for the target object.</param>
/// <param name="tags">The <see cref="TagCollection"/> being worked with.</param>
public static Tag Add(this TagCollection tags, string name, string objectish)
{
return tags.Add(name, objectish, false);
}
/// <summary>
/// Creates a lightweight tag with the specified name.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="objectish">Revparse spec for the target object.</param>
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
/// <param name="tags">The <see cref="TagCollection"/> being worked with.</param>
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);
}
/// <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, TagCollection.UnCanonicalizeName(name));
}
}
}
|