From e4d8e3f66eaf6fe6fcd41fa0babd40654271ed42 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 23 Aug 2022 18:56:56 -0400 Subject: [PATCH] added commit filtering by tag --- BLL/CommitDetail.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/BLL/CommitDetail.cs b/BLL/CommitDetail.cs index 4681e1d..d4c56c2 100644 --- a/BLL/CommitDetail.cs +++ b/BLL/CommitDetail.cs @@ -120,8 +120,29 @@ public class CommitDetail { using (var repo = new Repository(Directory.GetCurrentDirectory())) { - var tagResult = repo.Tags[tagName]; - System.Console.WriteLine(tagResult); + var tagResult = repo.Tags[tagName].Target.Sha; + + var commitFilter = new CommitFilter + { + IncludeReachableFrom = tagResult, + }; + + var query = repo.Commits.QueryBy(commitFilter); + + foreach (var c in query) + { + if (!_authors.Contains(c.Author.Name)) + { + _authors.Add(c.Author.Name); + } + } + + foreach (var a in _authors) + { + int commitCount = query.Where(r => r.Author.Name == a).Count(); + _commitDetails.Add(a, commitCount); + } + } } }