fixed exception

This commit is contained in:
Wyatt J. Miller 2022-07-29 19:51:22 -04:00
parent f732a666af
commit 150f9738ff
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
@ -10,7 +11,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="IronPdf" Version="2022.8.7894" /> <PackageReference Include="IronPdf" Version="2022.8.7894" />
<PackageReference Include="IronXL.Excel" Version="2022.7.7362" /> <PackageReference Include="IronXL.Excel" Version="2022.7.7362" />
<PackageReference Include="Libgit2sharp" Version="0.26.2" /> <PackageReference Include="Libgit2sharp" Version="0.27.0-preview-0182" />
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="2.0.315-alpha.0.9" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,25 +1,25 @@
using LibGit2Sharp; using LibGit2Sharp;
static class Public static class Program
{ {
internal static void Main(string[] args) internal static void Main(string[] args)
{ {
List<string> authors = new List<string>(); List<string> authors = new List<string>();
Dictionary<string, int> commitReport = new Dictionary<string, int>(); Dictionary<string, int> commitReport = new Dictionary<string, int>();
using (var repo = new Repository(@".")) using (var repo = new Repository(Directory.GetCurrentDirectory()))
{ {
foreach (var c in repo.Commits) foreach (var c in repo.Commits)
{ {
if (!authors.Contains(c.Author.Email)) if (!authors.Contains(c.Author.Name))
{ {
authors.Add(c.Author.Email); authors.Add(c.Author.Name);
} }
} }
foreach (var a in authors) foreach (var a in authors)
{ {
int commitCount = repo.Commits.OrderBy(a => a.Author).Count(); int commitCount = repo.Commits.Where(r => r.Author.Name == a).Count();
commitReport.Add(a, commitCount); commitReport.Add(a, commitCount);
} }