using System;
namespace LibGit2Sharp
{
///
/// Provides helper overloads to a .
///
public static class NoteCollectionExtensions
{
///
/// Creates or updates a on the specified object, and for the given namespace.
/// Both the Author and Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable.
///
/// The
/// The target , for which the note will be created.
/// The note message.
/// 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').
/// The note which was just saved.
public static Note Add(this NoteCollection collection, ObjectId targetId, string message, string @namespace)
{
Signature author = collection.repo.Config.BuildSignature(DateTimeOffset.Now, true);
return collection.Add(targetId, message, author, author, @namespace);
}
///
/// Deletes the note on the specified object, and for the given namespace.
/// Both the Author and Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable.
///
/// The
/// The target , for which the note will be created.
/// 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').
public static void Remove(this NoteCollection collection, ObjectId targetId, string @namespace)
{
Signature author = collection.repo.Config.BuildSignature(DateTimeOffset.Now, true);
collection.Remove(targetId, author, author, @namespace);
}
}
}