public bool Commit(string message, string authorName, string emailAddress)
{
using (var repo = new LibGit2Sharp.Repository(RepositoryPath))
{
var changes = repo.RetrieveStatus(new StatusOptions
{
DetectRenamesInIndex = false,
DetectRenamesInWorkDir = false
}).Select(c => c.FilePath);
if (!changes.Any())
{
return false;
}
repo.Stage(changes);
if (string.IsNullOrWhiteSpace(authorName) ||
string.IsNullOrWhiteSpace(emailAddress))
{
repo.Commit(message);
}
else
{
repo.Commit(message, new Signature(authorName, emailAddress, DateTimeOffset.UtcNow));
}
return true;
}
}