I'm using Lib2GitSharp to join the Git logs with information from some other systems and I would like to be able to retrieve all git logs since a certain date (or between dates).
I found documentation on querying the log here but it does not appear that there is a way to query the log by date. What would be the equivalent of
git log --since="2013-08-20"
in LibGit2Sharp?
Edit This seems to work but perhaps there a better and/or more elegant way?
using (var repo = new Repository(options.Repo))
{
var since = new DateTime(2013, 8, 20);
var commits = repo.Commits.Where(c => c.Committer.When.CompareTo(since) > 0);
foreach (Commit commit in commits)
{
Console.WriteLine("A commit happened at " + commit.Committer.When.ToLocalTime());
}
}