From 6e2f48e24b0c003b4c8547ff88fc1a7f890a1c1e Mon Sep 17 00:00:00 2001 From: Rory& Date: Thu, 11 Dec 2025 18:54:56 +0100 Subject: read indexes and packs correctly --- LibGitTest/WebRepoSource.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'LibGitTest/WebRepoSource.cs') diff --git a/LibGitTest/WebRepoSource.cs b/LibGitTest/WebRepoSource.cs index 39d9b79..04f5b29 100644 --- a/LibGitTest/WebRepoSource.cs +++ b/LibGitTest/WebRepoSource.cs @@ -4,7 +4,7 @@ namespace LibGitTest; public class WebRepoSource : IRepoSource { - private const bool _debug = false; + private const bool _debug = true; public WebRepoSource(string basePath) { BasePath = basePath; @@ -12,9 +12,18 @@ public class WebRepoSource : IRepoSource public string BasePath { get; set; } + public async Task FileExists(string path) + { + using var client = new HttpClient(); + if(_debug)Console.WriteLine("Checking file exists: " + Path.Join(BasePath, path)); + var response = await client.GetAsync(Path.Join(BasePath, path)); + if(_debug)Console.WriteLine("Response status code: " + response.StatusCode); + return response.IsSuccessStatusCode; + } + public async Task GetFileStream(string path) { - var client = new HttpClient(); + using 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)); -- cgit 1.5.1