Skip to content

Commit ca2c746

Browse files
committed
adapt to changes in gix
1 parent 67a6f82 commit ca2c746

File tree

2 files changed

+41
-5
lines changed

2 files changed

+41
-5
lines changed

gitoxide-core/src/repository/clone.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,24 @@ pub(crate) mod function {
9292
writeln!(err, "The cloned repository appears to be empty")?;
9393
}
9494
Status::DryRun { .. } => unreachable!("dry-run unsupported"),
95-
Status::Change { update_refs, .. } => {
95+
Status::Change {
96+
update_refs,
97+
negotiation_rounds,
98+
..
99+
} => {
96100
let remote = repo
97101
.find_default_remote(gix::remote::Direction::Fetch)
98102
.expect("one origin remote")?;
99103
let ref_specs = remote.refspecs(gix::remote::Direction::Fetch);
100-
print_updates(&repo, update_refs, ref_specs, fetch_outcome.ref_map, &mut out, &mut err)?;
104+
print_updates(
105+
&repo,
106+
negotiation_rounds,
107+
update_refs,
108+
ref_specs,
109+
fetch_outcome.ref_map,
110+
&mut out,
111+
&mut err,
112+
)?;
101113
}
102114
};
103115

gitoxide-core/src/repository/fetch.rs

+27-3
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,34 @@ pub(crate) mod function {
6363
let ref_specs = remote.refspecs(gix::remote::Direction::Fetch);
6464
match res.status {
6565
Status::NoPackReceived { update_refs } => {
66-
print_updates(&repo, update_refs, ref_specs, res.ref_map, &mut out, err)
66+
print_updates(&repo, 1, update_refs, ref_specs, res.ref_map, &mut out, err)
6767
}
68-
Status::DryRun { update_refs } => print_updates(&repo, update_refs, ref_specs, res.ref_map, &mut out, err),
68+
Status::DryRun {
69+
update_refs,
70+
negotiation_rounds,
71+
} => print_updates(
72+
&repo,
73+
negotiation_rounds,
74+
update_refs,
75+
ref_specs,
76+
res.ref_map,
77+
&mut out,
78+
err,
79+
),
6980
Status::Change {
7081
update_refs,
7182
write_pack_bundle,
83+
negotiation_rounds,
7284
} => {
73-
print_updates(&repo, update_refs, ref_specs, res.ref_map, &mut out, err)?;
85+
print_updates(
86+
&repo,
87+
negotiation_rounds,
88+
update_refs,
89+
ref_specs,
90+
res.ref_map,
91+
&mut out,
92+
err,
93+
)?;
7494
if let Some(data_path) = write_pack_bundle.data_path {
7595
writeln!(out, "pack file: \"{}\"", data_path.display()).ok();
7696
}
@@ -88,6 +108,7 @@ pub(crate) mod function {
88108

89109
pub(crate) fn print_updates(
90110
repo: &gix::Repository,
111+
negotiation_rounds: usize,
91112
update_refs: gix::remote::fetch::refs::update::Outcome,
92113
refspecs: &[gix::refspec::RefSpec],
93114
mut map: gix::remote::fetch::RefMap,
@@ -191,6 +212,9 @@ pub(crate) mod function {
191212
refspecs.len()
192213
)?;
193214
}
215+
if negotiation_rounds != 1 {
216+
writeln!(err, "needed {negotiation_rounds} rounds of pack-negotiation")?;
217+
}
194218
Ok(())
195219
}
196220
}

0 commit comments

Comments
 (0)