Skip to content

Commit 31a7089

Browse files
committed
feat: make some private methods public to give callers more flexibility. (#450)
This allows to implement the fetch-negotiation part oneself and break free from constraints of the delegate.
1 parent 5e93ef5 commit 31a7089

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

git-protocol/src/fetch/arguments/blocking_io.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use git_transport::{client, client::TransportV2Ext};
55
use crate::fetch::{Arguments, Command};
66

77
impl Arguments {
8-
pub(crate) fn send<'a, T: client::Transport + 'a>(
8+
/// Send fetch arguments to the server, and indicate this is the end of negotiations only if `add_done_argument` is present.
9+
pub fn send<'a, T: client::Transport + 'a>(
910
&mut self,
1011
transport: &'a mut T,
1112
add_done_argument: bool,

git-protocol/src/fetch/arguments/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,10 @@ impl Arguments {
125125
fn prefixed(&mut self, prefix: &str, value: impl fmt::Display) {
126126
self.args.push(format!("{}{}", prefix, value).into());
127127
}
128+
/// Create a new instance to help setting up arguments to send to the server as part of a `fetch` operation
129+
/// for which `features` are the available and configured features to use.
128130
#[cfg(any(feature = "async-client", feature = "blocking-client"))]
129-
pub(crate) fn new(version: git_transport::Protocol, features: Vec<crate::fetch::command::Feature>) -> Self {
131+
pub fn new(version: git_transport::Protocol, features: Vec<crate::fetch::command::Feature>) -> Self {
130132
use crate::fetch::Command;
131133
let has = |name: &str| features.iter().any(|f| f.0 == name);
132134
let filter = has("filter");

git-protocol/src/fetch/command.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ mod with_io {
112112
}
113113
}
114114

115-
/// Turns on all modern features for V1 and all supported features for V2.
116-
pub(crate) fn default_features(
115+
/// Turns on all modern features for V1 and all supported features for V2, returning them as a vector of features.
116+
/// Note that this is the basis for any fetch operation as these features fulfil basic requirements and reasonably up-to-date servers.
117+
pub fn default_features(
117118
&self,
118119
version: git_transport::Protocol,
119120
server_capabilities: &Capabilities,

git-repository/src/remote/connection/fetch/negotiate.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)