From a35b1e9379d84114314cbb5f34ff5158fbf82ad0 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Fri, 28 Jun 2019 16:29:50 -0500 Subject: [PATCH] wip git init, add, commit --- .../ListArchiver/CaptureLists.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/FilterLists.Agent/ListArchiver/CaptureLists.cs b/src/FilterLists.Agent/ListArchiver/CaptureLists.cs index e42447ecd..12addd663 100644 --- a/src/FilterLists.Agent/ListArchiver/CaptureLists.cs +++ b/src/FilterLists.Agent/ListArchiver/CaptureLists.cs @@ -1,8 +1,10 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using FilterLists.Agent.Entities; using FilterLists.Agent.Infrastructure; +using LibGit2Sharp; using MediatR; using RestSharp; @@ -27,11 +29,19 @@ public Handler(IFilterListsApiClient apiClient, IMediator mediator) protected override async Task Handle(Command request, CancellationToken cancellationToken) { - //TODO: git init if repo doesn't exist + const string workingDirectoryPath = @"archives"; + var lists = await GetListInfo(); await _mediator.Send(new DownloadLists.Command(lists), cancellationToken); - //TODO: git add . - //TODO: git commit + + + using (var repo = new Repository(workingDirectoryPath)) + { + Commands.Stage(repo, "*"); + var author = new Signature("James", "@jugglingnutcase", DateTime.UtcNow); + var committer = author; + var commit = repo.Commit("Here's a commit i made!", author, committer); + } } private async Task> GetListInfo()