8000 Fold NoteCollectionExtensions.cs into NoteCollection.cs · Svengali/libgit2sharp@265a9e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 265a9e9

Browse files
committed
Fold NoteCollectionExtensions.cs into NoteCollection.cs
1 parent db043ab commit 265a9e9

File tree

3 files changed

+28
-41
lines changed

3 files changed

+28
-41
lines changed

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
<Compile Include="MergeFetchHeadNotFoundException.cs" />
148148
<Compile Include="RepositoryOperationContext.cs" />
149149
<Compile Include="ResetMode.cs" />
150-
<Compile Include="NoteCollectionExtensions.cs" />
151150
<Compile Include="RefSpecDirection.cs" />
152151
<Compile Include="Core\GitStatusEntry.cs" />
153152
<Compile Include="Core\GitStatusOptions.cs" />

LibGit2Sharp/NoteCollection.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ internal static string UnCanonicalizeName(string name)
165165
return name.Substring(Reference.NotePrefix.Length);
166166
}
167167

168+
/// <summary>
169+
/// Creates or updates a <see cref="Note"/> on the specified object, and for the given namespace.
170+
/// <para>Both the Author and Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable.</para>
171+
/// </summary>
172+
/// <param name="targetId">The target <see cref="ObjectId"/>, for which the note will be created.</param>
173+
/// <param name="message">The note message.</param>
174+
/// <param name="namespace">The namespace on which the note will be created. It can be either a canonical namespace or an abbreviated namespace ('refs/notes/myNamespace' or just 'myNamespace').</param>
175+
/// <returns>The note which was just saved.</returns>
176+
public virtual Note Add(ObjectId targetId, string message, string @namespace)
177+
{
178+
Signature author = repo.Config.BuildSignature(DateTimeOffset.Now, true);
179+
180+
return Add(targetId, message, author, author, @namespace);
181+
}
182+
168183
/// <summary>
169184
/// Creates or updates a <see cref="Note&qu 8000 ot;/> on the specified object, and for the given namespace.
170185
/// </summary>
@@ -191,6 +206,19 @@ public virtual Note Add(ObjectId targetId, string message, Signature author, Sig
191206
return this[canonicalNamespace, targetId];
192207
}
193208

209+
/// <summary>
210+
/// Deletes the note on the specified object, and for the given namespace.
211+
/// <para>Both the Author and Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable.</para>
212+
/// </summary>
213+
/// <param name="targetId">The target <see cref="ObjectId"/>, for which the note will be created.</param>
214+
/// <param name="namespace">The namespace on which the note will be removed. It can be either a canonical namespace or an abbreviated namespace ('refs/notes/myNamespace' or just 'myNamespace').</param>
215+
public virtual void Remove(ObjectId targetId, string @namespace)
216+
{
217+
Signature author = repo.Config.BuildSignature(DateTimeOffset.Now, true);
218+
219+
Remove(targetId, author, author, @namespace);
220+
}
221+
194222
/// <summary>
195223
/// Deletes the note on the specified object, and for the given namespace.
196224
/// </summary>

LibGit2Sharp/NoteCollectionExtensions.cs

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

0 commit comments

Comments
 (0)
0