Skip to content

Commit a97488d

Browse files
committed
refactor!: flatten RefMap::new() arguments
1 parent 7974286 commit a97488d

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

gitoxide-core/src/pack/receive.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,10 @@ where
8585
let refmap = gix::protocol::fetch::RefMap::new(
8686
&mut progress,
8787
&fetch_refspecs,
88-
gix::protocol::fetch::Context {
89-
handshake: &mut handshake,
90-
transport: &mut transport.inner,
91-
user_agent: user_agent.clone(),
92-
trace_packetlines,
93-
},
88+
&mut handshake,
89+
&mut transport.inner,
90+
user_agent.clone(),
91+
trace_packetlines,
9492
gix::protocol::fetch::refmap::init::Options::default(),
9593
)
9694
.await?;

gix-protocol/src/fetch/refmap/init.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::collections::HashSet;
1+
use std::{borrow::Cow, collections::HashSet};
22

33
use bstr::{BString, ByteSlice, ByteVec};
44
use gix_features::progress::Progress;
@@ -11,11 +11,10 @@ use crate::transport::client::async_io::Transport;
1111
use crate::transport::client::blocking_io::Transport;
1212
use crate::{
1313
fetch::{
14-
self,
1514
refmap::{Mapping, Source, SpecIndex},
1615
RefMap,
1716
},
18-
handshake::Ref,
17+
handshake::{Outcome, Ref},
1918
};
2019

2120
/// The error returned by [`RefMap::new()`].
@@ -55,9 +54,6 @@ impl RefMap {
5554
/// Create a new instance by obtaining all references on the remote that have been filtered through our remote's
5655
/// for _fetching_.
5756
///
58-
/// A [context](fetch::Context) is provided to bundle what would be additional parameters,
59-
/// and [options](Options) are used to further configure the call.
60-
///
6157
/// * `progress` is used if `ls-refs` is invoked on the remote. Always the case when V2 is used.
6258
/// * `fetch_refspecs` are all explicit refspecs to identify references on the remote that you are interested in.
6359
/// Note that these are copied to [`RefMap::refspecs`] for convenience, as `RefMap::mappings` refer to them by index.
@@ -66,12 +62,10 @@ impl RefMap {
6662
pub async fn new<T>(
6763
mut progress: impl Progress,
6864
fetch_refspecs: &[gix_refspec::RefSpec],
69-
fetch::Context {
70-
handshake,
71-
transport,
72-
user_agent,
73-
trace_packetlines,
74-
}: fetch::Context<'_, T>,
65+
handshake: &mut Outcome,
66+
transport: &mut T,
67+
user_agent: (&'static str, Option<Cow<'static, str>>),
68+
trace_packetlines: bool,
7569
Options {
7670
prefix_from_spec_as_filter_on_remote,
7771
extra_refspecs,

gix/src/remote/connection/ref_map.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,10 @@ where
153153
let refmap = gix_protocol::fetch::RefMap::new(
154154
progress,
155155
&self.remote.fetch_specs,
156-
gix_protocol::fetch::Context {
157-
handshake: &mut handshake,
158-
transport: &mut self.transport.inner,
159-
user_agent: self.remote.repo.config.user_agent_tuple(),
160-
trace_packetlines: self.trace,
161-
},
156+
&mut handshake,
157+
&mut self.transport.inner,
158+
self.remote.repo.config.user_agent_tuple(),
159+
self.trace,
162160
gix_protocol::fetch::refmap::init::Options {
163161
prefix_from_spec_as_filter_on_remote,
164162
extra_refspecs,

0 commit comments

Comments
 (0)