8000 Fold TagCollectionExtensions.cs into TagCollection.cs · Svengali/libgit2sharp@73d7ea7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 73d7ea7

Browse files
committed
Fold TagCollectionExtensions.cs into TagCollection.cs
1 parent cacccc2 commit 73d7ea7

File tree

3 files changed

+67
-83
lines changed

3 files changed

+67
-83
lines changed

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@
252252
<Compile Include="SmartSubtransportStream.cs" />
253253
<Compile Include="Core\GitSmartSubtransport.cs" />
254254
<Compile Include="Core\GitSmartSubtransportStream.cs" />
255-
<Compile Include="TagCollectionExtensions.cs" />
256255
<Compile Include="Core\FilePath.cs" />
257256
<Compile Include="Core\FilePathExtensions.cs" />
258257
<Compile Include="Core\FilePathMarshaler.cs" />

LibGit2Sharp/TagCollection.cs

Lines changed: 67 additions & 2 deletions
225
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,60 @@ IEnumerator IEnumerable.GetEnumerator()
6969

7070
#endregion
7171

72+
/// <summary>
73+
/// Creates an annotated tag with the specified name.
74+
/// </summary>
75+
/// <param name="name">The name.</param>
76+
/// <param name="objectish">Revparse spec for the target object.</param>
77+
/// <param name="tagger">The tagger.</param>
78+
/// <param name="message">The message.</param>
79+
public virtual Tag Add(string name, string objectish, Signature tagger, string message)
80+
{
81+
return Add(name, objectish, tagger, message, false);
82+
}
83+
84+
/// <summary>
85+
/// Creates an annotated tag with the specified name.
86+
/// </summary>
87+
/// <param name="name">The name.</param>
88+
/// <param name="objectish">Revparse spec for the target object.</param>
89+
/// <param name="tagger">The tagger.</param>
90+
/// <param name="message">The message.</param>
91+
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
92+
public virtual Tag Add(string name, string objectish, Signature tagger, string message, bool allowOverwrite)
93+
{
94+
Ensure.ArgumentNotNullOrEmptyString(objectish, "target");
95+
96+
GitObject objectToTag = repo.Lookup(objectish, GitObjectType.Any, LookUpOptions.ThrowWhenNoGitObjectHasBeenFound);
97+
98+
return Add(name, objectToTag, tagger, message, allowOverwrite);
99+
}
100+
101+
/// <summary>
102+
/// Creates a lightweight tag with the specified name.
103+
/// </summary>
104+
/// <param name="name">The name.</param>
105+
/// <param name="objectish">Revparse spec for the target object.</param>
106+
public virtual Tag Add(string name, string objectish)
107+
{
108+
return Add(name, objectish, false);
109+
}
110+
111+
/// <summary>
112+
/// Creates a lightweight tag with the specified name.
113+
/// </summary>
114+
/// <param name="name">The name.</param>
115+
/// <param name="objectish">Revparse spec for the target object.</param>
116+
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
117+
public virtual Tag Add( string name, string objectish, bool allowOverwrite)
118+
{
119+
Ensure.ArgumentNotNullOrEmptyString(objectish, "objectish");
120+
121+
GitObject objectToTag = repo.Lookup(objectish, GitObjectType.Any, LookUpOptions.ThrowWhenNoGitObjectHasBeenFound);
122+
123+
return Add(name, objectToTag, allowOverwrite);
124+
}
125+
72126
/// <summary>
73127
/// Creates an annotated tag with the specified name.
74128
/// </summary>
@@ -133,6 +187,17 @@ public virtual Tag Add(string name, GitObject target, bool allowOverwrite)
133187
return this[name];
134188
}
135189

190+
/// <summary>
191+
/// Deletes the tag with the specified name.
192+
/// </summary>
193+
/// <param name="name">The short or canonical name of the tag to delete.</param>
194+
public virtual void Remove(string name)
195+
{
196+
Ensure.ArgumentNotNullOrEmptyString(name, "name");
197+
198+
Proxy.git_tag_delete(repo.Handle, UnCanonicalizeName(name));
199+
}
200+
136201
/// <summary>
137202
/// Deletes the tag with the specified name.
138203
/// </summary>
@@ -141,7 +206,7 @@ public virtual void Remove(Tag tag)
141206
{
142207
Ensure.ArgumentNotNull(tag, "tag");
143208

144-
this.Remove(tag.CanonicalName);
209+
Remove(tag.CanonicalName);
145210
}
146211

147212
private static string NormalizeToCanonicalName(string name)
@@ -156,7 +221,7 @@ private static string NormalizeToCanonicalName(string name)
156221
return string.Concat(Reference.TagPrefix, name);
157222
}
158223

159-
internal static string UnCanonicalizeName(string name)
224+
private static string UnCanonicalizeName(string name)
160
{
161226
Ensure.ArgumentNotNullOrEmptyString(name, "name");
162227

LibGit2Sharp/TagCollectionExtensions.cs

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0