check for git repo first

This commit is contained in:
Matt Parker
2025-11-02 11:26:58 +10:00
parent 54959918c9
commit 2966e733f1

View File

@@ -12,7 +12,10 @@ public static class VsPersistenceMapper
var intermediateModel = await IntermediateMapper.GetIntermediateModel(solutionFilePath, cancellationToken);
var solutionModel = new SharpIdeSolutionModel(solutionFilePath, intermediateModel);
using var repo = new Repository(solutionModel.DirectoryPath);
var gitFolderPath = Repository.Discover(solutionFilePath);
if (gitFolderPath is null) return solutionModel;
using var repo = new Repository(gitFolderPath);
var status = repo.RetrieveStatus(new StatusOptions());
foreach (var entry in status.Where(s => s.State is not FileStatus.Ignored))