namespace LibGit2Sharp
{
///
/// Commit metadata when rewriting history
///
public sealed class CommitRewriteInfo
{
///
/// The author to be used for the new commit
///
public Signature Author { get; set; }
///
/// The committer to be used for the new commit
///
public Signature Committer { get; set; }
///
/// The message to be used for the new commit
///
public string Message { get; set; }
///
/// Build a from the passed in
///
/// The whose information is to be copied
/// A new object that matches the info for the .
public static CommitRewriteInfo From(Commit commit)
{
return new CommitRewriteInfo
{
Author = commit.Author,
Committer = commit.Committer,
Message = commit.Message
};
}
///
/// Build a from the passed in,
/// optionally overriding some of its properties
///
/// The whose information is to be copied
/// Optional override for the author
/// Optional override for the committer
/// Optional override for the message
/// A new object that matches the info for the
/// with the optional parameters replaced..
public static CommitRewriteInfo From(Commit commit,
Signature author = null,
Signature committer = null,
string message = null)
{
var cri = From(commit);
cri.Author = author ?? cri.Author;
cri.Committer = committer ?? cri.Committer;
cri.Message = message ?? cri.Message;
return cri;
}
}
}