Skip to content

Commit

Permalink
adapt to changes in gix
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jun 5, 2023
1 parent 67a6f82 commit ca2c746
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
16 changes: 14 additions & 2 deletions gitoxide-core/src/repository/clone.rs
Expand Up @@ -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,
)?;
}
};

Expand Down
30 changes: 27 additions & 3 deletions gitoxide-core/src/repository/fetch.rs
Expand Up @@ -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();
}
Expand All @@ -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,
Expand Down Expand Up @@ -191,6 +212,9 @@ pub(crate) mod function {
refspecs.len()
)?;
}
if negotiation_rounds != 1 {
writeln!(err, "needed {negotiation_rounds} rounds of pack-negotiation")?;
}
Ok(())
}
}

0 comments on commit ca2c746

Please sign in to comment.