using System;
using LibGit2Sharp.Core;
using LibGit2Sharp.Core.Compat;
using LibGit2Sharp.Core.Handles;
namespace LibGit2Sharp
{
///
/// A TagAnnotation
///
public class TagAnnotation : GitObject
{
private Lazy targetBuilder;
internal TagAnnotation(ObjectId id)
: base(id)
{
}
///
/// Gets the name of this tag.
///
public string Name { get; private set; }
///
/// Gets the message of this tag.
///
public string Message { get; private set; }
///
/// Gets the that this tag annotation points to.
///
public GitObject Target
{
get { return targetBuilder.Value; }
}
///
/// Gets the tagger.
///
public Signature Tagger { get; private set; }
internal static TagAnnotation BuildFromPtr(GitObjectSafeHandle obj, ObjectId id, Repository repo)
{
ObjectId targetOid = NativeMethods.git_tag_target_oid(obj).MarshalAsObjectId();
return new TagAnnotation(id)
{
Message = NativeMethods.git_tag_message(obj),
Name = NativeMethods.git_tag_name(obj),
Tagger = new Signature(NativeMethods.git_tag_tagger(obj)),
targetBuilder = new Lazy(() => repo.Lookup(targetOid))
};
}
}
}