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 6, 2023
1 parent 6d05562 commit 022e9d8
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 022e9d8

Please sign in to comment.