upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-10 01:41:31 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-10 01:41:31 +0000
commit52430fe5db959dcc23fa965dd7aabcdc29db17a5 (patch)
tree001547957488ef32e729edee1b6a0820d781d7fa /src
parent3f19ab476799071d11e5f61074b60e31511f68a2 (diff)
fix: propagate git fetch errors instead of logging misleading success
Diffstat (limited to 'src')
-rw-r--r--src/purgatory/sync/context.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/purgatory/sync/context.rs b/src/purgatory/sync/context.rs
index 4d34c7c..e61de01 100644
--- a/src/purgatory/sync/context.rs
+++ b/src/purgatory/sync/context.rs
@@ -345,7 +345,7 @@ impl SyncContext for RealSyncContext {
345 let url = url.to_string(); 345 let url = url.to_string();
346 let missing_oids: Vec<String> = missing.into_iter().cloned().collect(); 346 let missing_oids: Vec<String> = missing.into_iter().cloned().collect();
347 347
348 let fetched = tokio::task::spawn_blocking(move || -> Vec<String> { 348 tokio::task::spawn_blocking(move || -> Result<Vec<String>> {
349 // git fetch <remote> <sha1> <sha2> ... - fetch all OIDs in one command 349 // git fetch <remote> <sha1> <sha2> ... - fetch all OIDs in one command
350 let mut args = vec!["fetch", "--depth=1", &url]; 350 let mut args = vec!["fetch", "--depth=1", &url];
351 args.extend(missing_oids.iter().map(|s| s.as_str())); 351 args.extend(missing_oids.iter().map(|s| s.as_str()));
@@ -366,29 +366,17 @@ impl SyncContext for RealSyncContext {
366 366
367 debug!(fetched_count = fetched.len(), "Successfully fetched OIDs"); 367 debug!(fetched_count = fetched.len(), "Successfully fetched OIDs");
368 368
369 fetched 369 Ok(fetched)
370 } 370 }
371 Ok(result) => { 371 Ok(result) => {
372 let stderr = String::from_utf8_lossy(&result.stderr); 372 let stderr = String::from_utf8_lossy(&result.stderr);
373 debug!( 373 Err(anyhow::anyhow!("git fetch failed: {}", stderr))
374 stderr = %stderr,
375 "git fetch failed"
376 );
377 vec![]
378 }
379 Err(e) => {
380 debug!(
381 error = %e,
382 "git fetch command error"
383 );
384 vec![]
385 } 374 }
375 Err(e) => Err(anyhow::anyhow!("git fetch command error: {}", e)),
386 } 376 }
387 }) 377 })
388 .await 378 .await
389 .map_err(|e| anyhow::anyhow!("Failed to spawn blocking task: {}", e))?; 379 .map_err(|e| anyhow::anyhow!("Failed to spawn blocking task: {}", e))?
390
391 Ok(fetched)
392 } 380 }
393 381
394 async fn process_newly_available_git_data( 382 async fn process_newly_available_git_data(