Skip to content

Commit 665b53e

Browse files
committed
Merge branch 'http-config'
2 parents 42356ab + b5c316e commit 665b53e

File tree

98 files changed

+2343
-1074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2343
-1074
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ gitoxide-core-tools = ["gitoxide-core/organize", "gitoxide-core/estimate-hours"]
7070
## Use blocking client networking.
7171
gitoxide-core-blocking-client = ["gitoxide-core/blocking-client"]
7272
## Support synchronous 'http' and 'https' transports (e.g. for clone, fetch and push) at the expense of compile times and binary size.
73-
http-client-curl = ["git-transport-for-configuration-only/http-client-curl"]
73+
http-client-curl = ["git-repository/blocking-http-transport"]
7474
## Use async client networking.
7575
gitoxide-core-async-client = ["gitoxide-core/async-client", "futures-lite"]
7676

@@ -86,8 +86,6 @@ gitoxide-core = { version = "^0.20.0", path = "gitoxide-core" }
8686
git-features = { version = "^0.23.1", path = "git-features" }
8787
git-repository = { version = "^0.27.0", path = "git-repository", default-features = false }
8888

89-
git-transport-for-configuration-only = { package = "git-transport", optional = true, version = "^0.21.2", path = "git-transport" }
90-
9189
clap = { version = "3.2.5", features = ["derive", "cargo"] }
9290
prodash = { version = "21", optional = true, default-features = false }
9391
atty = { version = "0.2.14", optional = true, default-features = false }

STABILITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ How do we avoid staying in the initial development phase (IDP) forever?
136136

137137
There is a couple of questions to ask and answer positively:
138138

139+
- _Is everything in it's tracking issue named "`<crate-name>` towards 1.0" resolved?_
139140
- _Does the crate fulfill its intended purpose well enough?_
140141
- _Do the dependent workspace crates fulfill their intended purposes well enough?_
141142
- _Do they hide types and functionality of lower-tier workspace crates and external IDP crates?_

git-config-value/src/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub struct Color {
2525
/// suffix after fetching the value. [`integer::Suffix`] provides
2626
/// [`bitwise_offset()`][integer::Suffix::bitwise_offset] to help with the
2727
/// math, or [to_decimal()][Integer::to_decimal()] for obtaining a usable value in one step.
28-
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
28+
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
2929
pub struct Integer {
3030
/// The value, without any suffix modification
3131
pub value: i64,
@@ -34,7 +34,7 @@ pub struct Integer {
3434
}
3535

3636
/// Any value that can be interpreted as a boolean.
37-
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
37+
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
3838
#[allow(missing_docs)]
3939
pub struct Boolean(pub bool);
4040

git-glob/tests/matching/mod.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

git-protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ required-features = ["async-client"]
4040

4141
[dependencies]
4242
git-features = { version = "^0.23.1", path = "../git-features", features = ["progress"] }
43-
git-transport = { version = "^0.21.1", path = "../git-transport" }
43+
git-transport = { version = "^0.21.2", path = "../git-transport" }
4444
git-hash = { version = "^0.9.11", path = "../git-hash" }
4545
git-credentials = { version = "^0.6.1", path = "../git-credentials" }
4646

git-protocol/src/fetch/command.rs renamed to git-protocol/src/command/mod.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
/// The kind of command to invoke on the server side.
2-
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
3-
pub enum Command {
4-
/// List references.
5-
LsRefs,
6-
/// Fetch a pack.
7-
Fetch,
8-
}
1+
//! V2 command abstraction to validate invocations and arguments, like a database of what we know about them.
2+
use super::Command;
3+
use std::borrow::Cow;
94

105
/// A key value pair of values known at compile time.
11-
pub type Feature = (&'static str, Option<&'static str>);
6+
pub type Feature = (&'static str, Option<Cow<'static, str>>);
127

138
impl Command {
149
/// Produce the name of the command as known by the server side.
@@ -25,7 +20,7 @@ mod with_io {
2520
use bstr::{BString, ByteSlice};
2621
use git_transport::client::Capabilities;
2722

28-
use crate::fetch::{agent, command::Feature, Command};
23+
use crate::{command::Feature, Command};
2924

3025
impl Command {
3126
/// Only V2
@@ -134,14 +129,13 @@ mod with_io {
134129
feature => server_capabilities.contains(feature),
135130
})
136131
.map(|s| (s, None))
137-
.chain(Some(agent()))
138132
.collect()
139133
}
140134
git_transport::Protocol::V2 => {
141135
let supported_features: Vec<_> = server_capabilities
142136
.iter()
143137
.find_map(|c| {
144-
if c.name() == Command::Fetch.as_str().as_bytes().as_bstr() {
138+
if c.name() == Command::Fetch.as_str() {
145139
c.values().map(|v| v.map(|f| f.to_owned()).collect())
146140
} else {
147141
None
@@ -153,11 +147,10 @@ mod with_io {
153147
.copied()
154148
.filter(|feature| supported_features.iter().any(|supported| supported == feature))
155149
.map(|s| (s, None))
156-
.chain(Some(agent()))
157150
.collect()
158151
}
159152
},
160-
Command::LsRefs => vec![agent()],
153+
Command::LsRefs => vec![],
161154
}
162155
}
163156
/// Panics if the given arguments and features don't match what's statically known. It's considered a bug in the delegate.
@@ -212,3 +205,6 @@ mod with_io {
212205
}
213206
}
214207
}
208+
209+
#[cfg(test)]
210+
mod tests;

git-protocol/src/fetch/tests/command.rs renamed to git-protocol/src/command/tests.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ mod v1 {
88
const GITHUB_CAPABILITIES: &str = "multi_ack thin-pack side-band ofs-delta shallow deepen-since deepen-not deepen-relative no-progress include-tag allow-tip-sha1-in-want allow-reachable-sha1-in-want no-done symref=HEAD:refs/heads/main filter agent=git/github-gdf51a71f0236";
99
mod fetch {
1010
mod default_features {
11-
use crate::fetch::{
12-
self,
13-
tests::command::v1::{capabilities, GITHUB_CAPABILITIES},
14-
Command,
15-
};
11+
use crate::command::tests::v1::{capabilities, GITHUB_CAPABILITIES};
12+
use crate::Command;
1613

1714
#[test]
1815
fn it_chooses_the_best_multi_ack_and_sideband() {
@@ -21,7 +18,7 @@ mod v1 {
2118
git_transport::Protocol::V1,
2219
&capabilities("multi_ack side-band side-band-64k multi_ack_detailed")
2320
),
24-
&[("side-band-64k", None), ("multi_ack_detailed", None), fetch::agent()]
21+
&[("side-band-64k", None), ("multi_ack_detailed", None),]
2522
);
2623
}
2724

@@ -42,7 +39,6 @@ mod v1 {
4239
("allow-reachable-sha1-in-want", None),
4340
("no-done", None),
4441
("filter", None),
45-
fetch::agent()
4642
],
4743
"we don't enforce include-tag or no-progress"
4844
);
@@ -61,7 +57,8 @@ mod v2 {
6157

6258
mod fetch {
6359
mod default_features {
64-
use crate::fetch::{self, tests::command::v2::capabilities, Command};
60+
use crate::command::tests::v2::capabilities;
61+
use crate::Command;
6562

6663
#[test]
6764
fn all_features() {
@@ -73,7 +70,6 @@ mod v2 {
7370
["shallow", "filter", "ref-in-want", "sideband-all", "packfile-uris"]
7471
.iter()
7572
.map(|s| (*s, None))
76-
.chain(Some(fetch::agent()))
7773
.collect::<Vec<_>>()
7874
)
7975
}
@@ -82,7 +78,8 @@ mod v2 {
8278
mod initial_arguments {
8379
use bstr::ByteSlice;
8480

85-
use crate::fetch::{tests::command::v2::capabilities, Command};
81+
use crate::command::tests::v2::capabilities;
82+
use crate::Command;
8683

8784
#[test]
8885
fn for_all_features() {
@@ -102,7 +99,8 @@ mod v2 {
10299

103100
mod ls_refs {
104101
mod default_features {
105-
use crate::fetch::{self, tests::command::v2::capabilities, Command};
102+
use crate::command::tests::v2::capabilities;
103+
use crate::Command;
106104

107105
#[test]
108106
fn default_as_there_are_no_features() {
@@ -111,15 +109,16 @@ mod v2 {
111109
git_transport::Protocol::V2,
112110
&capabilities("something-else", "does not matter as there are none")
113111
),
114-
&[fetch::agent()]
112+
&[]
115113
);
116114
}
117115
}
118116

119117
mod validate {
120118
use bstr::ByteSlice;
121119

122-
use crate::fetch::{tests::command::v2::capabilities, Command};
120+
use crate::command::tests::v2::capabilities;
121+
use crate::Command;
123122

124123
#[test]
125124
fn ref_prefixes_can_always_be_used() {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use futures_lite::io::AsyncWriteExt;
22
use git_transport::{client, client::TransportV2Ext};
33

4-
use crate::fetch::{Arguments, Command};
4+
use crate::fetch::Arguments;
5+
use crate::Command;
56

67
impl Arguments {
78
/// Send fetch arguments to the server, and indicate this is the end of negotiations only if `add_done_argument` is present.

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use std::io::Write;
22

33
use git_transport::{client, client::TransportV2Ext};
44

5-
use crate::fetch::{Arguments, Command};
5+
use crate::fetch::Arguments;
6+
use crate::Command;
67

78
impl Arguments {
89
/// Send fetch arguments to the server, and indicate this is the end of negotiations only if `add_done_argument` is present.
@@ -45,7 +46,9 @@ impl Arguments {
4546
}
4647
transport.invoke(
4748
Command::Fetch.as_str(),
48-
self.features.iter().filter(|(_, v)| v.is_some()).cloned(),
49+
self.features
50+
.iter()
51+
.filter_map(|(k, v)| v.as_ref().map(|v| (*k, Some(v.as_ref())))),
4952
Some(std::mem::replace(&mut self.args, retained_state).into_iter()),
5053
)
5154
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bstr::{BStr, BString, ByteSlice, ByteVec};
77
pub struct Arguments {
88
/// The active features/capabilities of the fetch invocation
99
#[cfg(any(feature = "async-client", feature = "blocking-client"))]
10-
features: Vec<crate::fetch::command::Feature>,
10+
features: Vec<crate::command::Feature>,
1111

1212
args: Vec<BString>,
1313
haves: Vec<BString>,
@@ -136,8 +136,8 @@ impl Arguments {
136136
/// Create a new instance to help setting up arguments to send to the server as part of a `fetch` operation
137137
/// for which `features` are the available and configured features to use.
138138
#[cfg(any(feature = "async-client", feature = "blocking-client"))]
139-
pub fn new(version: git_transport::Protocol, features: Vec<crate::fetch::command::Feature>) -> Self {
140-
use crate::fetch::Command;
139+
pub fn new(version: git_transport::Protocol, features: Vec<crate::command::Feature>) -> Self {
140+
use crate::Command;
141141
let has = |name: &str| features.iter().any(|f| f.0 == name);
142142
let filter = has("filter");
143143
let shallow = has("shallow");

0 commit comments

Comments
 (0)