fix: propagate git fetch errors instead of logging misleading success

This commit is contained in:
DanConwayDev
2026-01-10 01:41:31 +00:00
parent 3f19ab4767
commit 52430fe5db
+5 -17
View File
@@ -345,7 +345,7 @@ impl SyncContext for RealSyncContext {
let url = url.to_string();
let missing_oids: Vec<String> = missing.into_iter().cloned().collect();
let fetched = tokio::task::spawn_blocking(move || -> Vec<String> {
tokio::task::spawn_blocking(move || -> Result<Vec<String>> {
// git fetch <remote> <sha1> <sha2> ... - fetch all OIDs in one command
let mut args = vec!["fetch", "--depth=1", &url];
args.extend(missing_oids.iter().map(|s| s.as_str()));
@@ -366,29 +366,17 @@ impl SyncContext for RealSyncContext {
debug!(fetched_count = fetched.len(), "Successfully fetched OIDs");
fetched
Ok(fetched)
}
Ok(result) => {
let stderr = String::from_utf8_lossy(&result.stderr);
debug!(
stderr = %stderr,
"git fetch failed"
);
vec![]
}
Err(e) => {
debug!(
error = %e,
"git fetch command error"
);
vec![]
Err(anyhow::anyhow!("git fetch failed: {}", stderr))
}
Err(e) => Err(anyhow::anyhow!("git fetch command error: {}", e)),
}
})
.await
.map_err(|e| anyhow::anyhow!("Failed to spawn blocking task: {}", e))?;
Ok(fetched)
.map_err(|e| anyhow::anyhow!("Failed to spawn blocking task: {}", e))?
}
async fn process_newly_available_git_data(