fix(archival): 🐛 validate git repo vs just directory existence

This commit is contained in:
Collin M. Barrett 2021-01-30 13:20:16 -06:00
parent 5a2cf4caf1
commit 8247982aef

View file

@ -1,5 +1,4 @@
using System.Linq;
using FilterLists.Archival.Domain.ListArchives;
using FilterLists.Archival.Domain.ListArchives;
using FilterLists.Archival.Infrastructure.Options;
using LibGit2Sharp;
using Microsoft.Extensions.Configuration;
@ -15,7 +14,7 @@ public static void AddPersistenceServices(this IServiceCollection services, ICon
services.AddTransient<IRepository, Repository>(_ =>
{
var gitOptions = configuration.GetSection(GitOptions.Key).Get<GitOptions>();
if (!System.IO.Directory.EnumerateFileSystemEntries(gitOptions.RepositoryPath).Any())
if (!Repository.IsValid(gitOptions.RepositoryPath))
{
Repository.Init(gitOptions.RepositoryPath);
}