From fa7adf840ac2d78defee398a61b60888f615622a Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 7 Aug 2025 17:49:02 +0100 Subject: fix(send): refs not confirmed are usually accepted having implemented 3b5c48f5a2a4b9be5d14baa8f5e801fefd5c1166, a ref pushed to refs/nostr/ on a github repo was accepted but was not confirmed --- src/bin/ngit/sub_commands/sync.rs | 4 ++-- src/lib/push.rs | 15 +++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/bin/ngit/sub_commands/sync.rs b/src/bin/ngit/sub_commands/sync.rs index e7033b2..00dfe75 100644 --- a/src/bin/ngit/sub_commands/sync.rs +++ b/src/bin/ngit/sub_commands/sync.rs @@ -141,8 +141,8 @@ pub async fn launch(args: &SubCommandArgs) -> Result<()> { "error pushing updates to {remote_name}: error: {error}" ))?; } - Ok(failed_refs) => { - if failed_refs.is_empty() { + Ok(updated_refs) => { + if updated_refs.values().all(std::option::Option::is_none) { if *is_grasp_server || args.force { term.write_line(&format!("{remote_name} sync completed"))?; // TODO we only know if there was an error but not diff --git a/src/lib/push.rs b/src/lib/push.rs index 0ee66cf..8cb0212 100644 --- a/src/lib/push.rs +++ b/src/lib/push.rs @@ -63,10 +63,9 @@ pub fn push_to_remote( } Ok(ref_updates_on_protocol) => { success = true; - if remote_refspecs.len() == ref_updates_on_protocol.len() - && ref_updates_on_protocol - .values() - .all(|error| error.is_none()) + if ref_updates_on_protocol + .values() + .all(|error| error.is_none()) { if !failed_protocols.is_empty() { term.write_line(format!("push: succeeded over {protocol}").as_str())?; @@ -444,14 +443,6 @@ pub async fn push_refs_and_generate_pr_or_pr_update_event( "push: error sending commit data to {normalized_url}: {error}" ))?; responses.push((clone_url.clone(), Err(anyhow!(error.clone())))); - } else if ref_updates.is_empty() { - term.write_line(&format!( - "push: error sending commit data to {normalized_url}: server didn't confirm acceptance" - ))?; - responses.push(( - clone_url.clone(), - Err(anyhow!("server didn't confirm acceptance")), - )); } else { responses.push((clone_url.clone(), Ok(()))); term.write_line(&format!("push: commit data sent to {normalized_url}"))?; -- cgit v1.2.3