C#如何使用libgit2Sharp读取提交时间

urz*_*.cc 2 c# git libgit2sharp

我试图使用libgit2Sharp列出存储库中的所有提交,其作者和提交日期,但提交对象没有创建提交的日期/时间属性.

 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.???
  }
Run Code Online (Sandbox Code Playgroud)

我没有在官方页面上找到libgit2sharp项目的任何文档:

让我们简单地说:我们目前缺乏适当的文档.任何关于这个主题的帮助将不胜感激;-)

我怎样才能访问commit的时间?

Edw*_*son 5

提交或提交提交的日期是Signature名称和电子邮件地址的一部分.When签名的成员DateTimeOffset是创作或提交的成员.如果您在示例中查找作者日期,那么您需要:

com.Author.When
Run Code Online (Sandbox Code Playgroud)