Skip to content

Commit 68580d1

Browse files
committed
adapt to changes in gix
1 parent b6f7974 commit 68580d1

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

gitoxide-core/src/repository/clone.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,20 @@ pub(crate) mod function {
8888
}
8989

9090
match fetch_outcome.status {
91-
Status::NoPackReceived { .. } => {
91+
Status::NoPackReceived { dry_run, .. } => {
92+
assert!(!dry_run, "dry-run unsupported");
9293
writeln!(err, "The cloned repository appears to be empty")?;
9394
}
94-
Status::DryRun { .. } => unreachable!("dry-run unsupported"),
9595
Status::Change {
96-
update_refs,
97-
negotiation_rounds,
98-
..
96+
update_refs, negotiate, ..
9997
} => {
10098
let remote = repo
10199
.find_default_remote(gix::remote::Direction::Fetch)
102100
.expect("one origin remote")?;
103101
let ref_specs = remote.refspecs(gix::remote::Direction::Fetch);
104102
print_updates(
105103
&repo,
106-
negotiation_rounds,
104+
negotiate,
107105
update_refs,
108106
ref_specs,
109107
fetch_outcome.ref_map,

gitoxide-core/src/repository/fetch.rs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ pub(crate) mod function {
6262

6363
let ref_specs = remote.refspecs(gix::remote::Direction::Fetch);
6464
match res.status {
65-
Status::NoPackReceived { update_refs } => {
66-
print_updates(&repo, 1, update_refs, ref_specs, res.ref_map, &mut out, err)
67-
}
68-
Status::DryRun {
65+
Status::NoPackReceived {
6966
update_refs,
70-
negotiation_rounds,
67+
negotiate,
68+
dry_run: _,
7169
} => print_updates(
7270
&repo,
73-
negotiation_rounds,
71+
negotiate.unwrap_or_default(),
7472
update_refs,
7573
ref_specs,
7674
res.ref_map,
@@ -80,17 +78,9 @@ pub(crate) mod function {
8078
Status::Change {
8179
update_refs,
8280
write_pack_bundle,
83-
negotiation_rounds,
81+
negotiate,
8482
} => {
85-
print_updates(
86-
&repo,
87-
negotiation_rounds,
88-
update_refs,
89-
ref_specs,
90-
res.ref_map,
91-
&mut out,
92-
err,
93-
)?;
83+
print_updates(&repo, negotiate, update_refs, ref_specs, res.ref_map, &mut out, err)?;
9484
if let Some(data_path) = write_pack_bundle.data_path {
9585
writeln!(out, "pack file: \"{}\"", data_path.display()).ok();
9686
}
@@ -108,7 +98,7 @@ pub(crate) mod function {
10898

10999
pub(crate) fn print_updates(
110100
repo: &gix::Repository,
111-
negotiation_rounds: usize,
101+
negotiate: gix::remote::fetch::outcome::Negotiate,
112102
update_refs: gix::remote::fetch::refs::update::Outcome,
113103
refspecs: &[gix::refspec::RefSpec],
114104
mut map: gix::remote::fetch::RefMap,
@@ -212,8 +202,10 @@ pub(crate) mod function {
212202
refspecs.len()
213203
)?;
214204
}
215-
if negotiation_rounds != 1 {
216-
writeln!(err, "needed {negotiation_rounds} rounds of pack-negotiation")?;
205+
match negotiate.rounds.len() {
206+
0 => writeln!(err, "no negotiation was necessary")?,
207+
1 => {}
208+
rounds => writeln!(err, "needed {rounds} rounds of pack-negotiation")?,
217209
}
218210
Ok(())
219211
}

0 commit comments

Comments
 (0)