Skip to content

Commit 8d5977d

Browse files
committed
Include git information in json file
1 parent 9731b7d commit 8d5977d

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

StyleCop.Analyzers.Status.Generator/Program.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{
33
using System;
44
using System.IO;
5+
using System.Linq;
56
using LibGit2Sharp;
67
using Newtonsoft.Json;
78

@@ -26,20 +27,29 @@ internal static void Main(string[] args)
2627

2728
var diagnostics = reader.GetDiagnosticsAsync().Result;
2829

30+
Commit commit;
2931
string commitId;
3032

3133
using (Repository repository = new Repository(Path.GetDirectoryName(args[0])))
3234
{
3335
commitId = repository.Head.Tip.Sha;
34-
}
36+
commit = repository.Head.Tip;
3537

36-
var output = new
37-
{
38-
diagnostics,
39-
commitId
40-
};
38+
var output = new
39+
{
40+
diagnostics,
41+
git = new
42+
{
43+
commit.Sha,
44+
commit.Message,
45+
commit.Author,
46+
commit.Committer,
47+
Parents = commit.Parents.Select(x => x.Sha)
48+
}
49+
};
4150

42-
Console.WriteLine(JsonConvert.SerializeObject(output));
51+
Console.WriteLine(JsonConvert.SerializeObject(output));
52+
}
4353
}
4454
}
4555
}

0 commit comments

Comments
 (0)