I am trying to list all commits in repository, their Authors and date of commit using libgit2Sharp, but the commit object doesn't have property of date/time where the commit was created.
using (var repo = new Repository(path))
{
///get commits from all branches, not just master
var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs });
//here I can access commit's author, but not time
commits.Select(com => new { Author = com.Author.Name, Date = com.???
}
I didn't find any documentation of the libgit2sharp project, on the official page it says:
Let's put it simply: we currently lack proper documentation. Any help on this subject would be greatly appreciated ;-)
How can I access commit's time?
The date a commit was authored or committed is part of the Signature
, along side the name and email address. The When
member of the signature is a DateTimeOffset
it was authored or committed. If you're looking for the authorship date in your example, then you want:
com.Author.When
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With