using LibGit.Interfaces; namespace LibGitTest; public class WebRepoSource : IRepoSource { private const bool _debug = false; public WebRepoSource(string basePath) { BasePath = basePath; } public string BasePath { get; set; } public async Task GetFileStream(string path) { var client = new HttpClient(); if(_debug)Console.WriteLine("Fetching file: " + Path.Join(BasePath, path)); var response = await client.GetAsync(Path.Join(BasePath, path)); if(!response.IsSuccessStatusCode) throw new Exception("Failed to fetch file: " + Path.Join(BasePath, path)); return await response.Content.ReadAsStreamAsync(); } public async Task HasObjectCached(string currentCommitId) { return Random.Shared.Next(0, 2) == 1; } }