From ca2c7461204f35d7fc1d138f061dc2a39946d1c1 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 5 Jun 2023 20:59:45 +0200 Subject: [PATCH] adapt to changes in `gix` --- gitoxide-core/src/repository/clone.rs | 16 ++++++++++++-- gitoxide-core/src/repository/fetch.rs | 30 ++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/gitoxide-core/src/repository/clone.rs b/gitoxide-core/src/repository/clone.rs index b92e0d9f60b..3a29fd7138f 100644 --- a/gitoxide-core/src/repository/clone.rs +++ b/gitoxide-core/src/repository/clone.rs @@ -92,12 +92,24 @@ pub(crate) mod function { writeln!(err, "The cloned repository appears to be empty")?; } Status::DryRun { .. } => unreachable!("dry-run unsupported"), - Status::Change { update_refs, .. } => { + Status::Change { + update_refs, + negotiation_rounds, + .. + } => { let remote = repo .find_default_remote(gix::remote::Direction::Fetch) .expect("one origin remote")?; let ref_specs = remote.refspecs(gix::remote::Direction::Fetch); - print_updates(&repo, update_refs, ref_specs, fetch_outcome.ref_map, &mut out, &mut err)?; + print_updates( + &repo, + negotiation_rounds, + update_refs, + ref_specs, + fetch_outcome.ref_map, + &mut out, + &mut err, + )?; } }; diff --git a/gitoxide-core/src/repository/fetch.rs b/gitoxide-core/src/repository/fetch.rs index 3ee8459a870..d2139b9415e 100644 --- a/gitoxide-core/src/repository/fetch.rs +++ b/gitoxide-core/src/repository/fetch.rs @@ -63,14 +63,34 @@ pub(crate) mod function { let ref_specs = remote.refspecs(gix::remote::Direction::Fetch); match res.status { Status::NoPackReceived { update_refs } => { - print_updates(&repo, update_refs, ref_specs, res.ref_map, &mut out, err) + print_updates(&repo, 1, update_refs, ref_specs, res.ref_map, &mut out, err) } - Status::DryRun { update_refs } => print_updates(&repo, update_refs, ref_specs, res.ref_map, &mut out, err), + Status::DryRun { + update_refs, + negotiation_rounds, + } => print_updates( + &repo, + negotiation_rounds, + update_refs, + ref_specs, + res.ref_map, + &mut out, + err, + ), Status::Change { update_refs, write_pack_bundle, + negotiation_rounds, } => { - print_updates(&repo, update_refs, ref_specs, res.ref_map, &mut out, err)?; + print_updates( + &repo, + negotiation_rounds, + update_refs, + ref_specs, + res.ref_map, + &mut out, + err, + )?; if let Some(data_path) = write_pack_bundle.data_path { writeln!(out, "pack file: \"{}\"", data_path.display()).ok(); } @@ -88,6 +108,7 @@ pub(crate) mod function { pub(crate) fn print_updates( repo: &gix::Repository, + negotiation_rounds: usize, update_refs: gix::remote::fetch::refs::update::Outcome, refspecs: &[gix::refspec::RefSpec], mut map: gix::remote::fetch::RefMap, @@ -191,6 +212,9 @@ pub(crate) mod function { refspecs.len() )?; } + if negotiation_rounds != 1 { + writeln!(err, "needed {negotiation_rounds} rounds of pack-negotiation")?; + } Ok(()) } }