mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
refactor(archival): ♻ only init new git repo on empty dir
This commit is contained in:
parent
8cabf0f725
commit
2a1e8aefae
1 changed files with 3 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using FilterLists.Archival.Domain.Lists;
|
||||
using System.Linq;
|
||||
using FilterLists.Archival.Domain.Lists;
|
||||
using FilterLists.Archival.Infrastructure.Options;
|
||||
using LibGit2Sharp;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
|
@ -14,7 +15,7 @@ public static void AddPersistenceServices(this IServiceCollection services, ICon
|
|||
services.AddTransient<IRepository, Repository>(_ =>
|
||||
{
|
||||
var gitOptions = configuration.GetSection(GitOptions.Key).Get<GitOptions>();
|
||||
if (!Repository.IsValid(gitOptions.RepositoryPath))
|
||||
if (!System.IO.Directory.EnumerateFileSystemEntries(gitOptions.RepositoryPath).Any())
|
||||
{
|
||||
Repository.Init(gitOptions.RepositoryPath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue