Skip to content

configure http transport #586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 97 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
1afaebd
keep track of http related configuration keys.
Byron Nov 8, 2022
7c5b37d
Merge branch 'main' into http-config
Byron Nov 8, 2022
63e24fc
a sketch of passing curl options down to curl…
Byron Nov 9, 2022
a8b3f96
sketch of reqwest specific backends can be handled
Byron Nov 9, 2022
c6a474c
Remove double-arc construct in `reqwest` backend
Byron Nov 9, 2022
4724604
A note about the status of the http `reqwest` backend
Byron Nov 9, 2022
58efaac
adjust package size limits
Byron Nov 9, 2022
cfc1b9c
Add all fields we'd like to implement for the curl transport.
Byron Nov 9, 2022
0b60097
implement all straightforward curl options, which includes basic prox…
Byron Nov 9, 2022
328c069
explain how the `user_agent` option is going to work on the transport…
Byron Nov 9, 2022
f957d9a
change!: `fetch::agent()` now returns the agent name, `fetch::agent_t…
Byron Nov 9, 2022
28615b3
change: `TransportV2Ext::invoke(…,features,…)` can take key-value pai…
Byron Nov 9, 2022
aab278f
change!: don't auto-insert user agent, instead prepare to insert it l…
Byron Nov 9, 2022
759b5d4
change!: `client::TransportV2Ext::invoke()` supports owned `capabilit…
Byron Nov 9, 2022
d05b0b8
change!: `fetch::agent()` returns agent string only; `fetch()` takes …
Byron Nov 9, 2022
b9a5eea
fix build
Byron Nov 9, 2022
68dc86f
make trait parameter more open, no need for `'static`
Byron Nov 9, 2022
121c93f
adapt to changes in `git-protocol`
Byron Nov 9, 2022
e60d079
feat: add `env::agent()` for obtaining the default client agent string.
Byron Nov 10, 2022
39c1af7
adapt to changes in `git-repository`
Byron Nov 10, 2022
f5499a5
plan for user agent string configuration
Byron Nov 10, 2022
709a732
feat: Support for user-costomizable user agent strings.
Byron Nov 10, 2022
1c012f4
update progress with gitoxide.userAgent
Byron Nov 10, 2022
2ef0e09
fix build
Byron Nov 10, 2022
21bd85d
first step for basic test of simple http configuration
Byron Nov 10, 2022
7ca4dec
add missing `Debug` impl on transport option types
Byron Nov 10, 2022
9ff70e9
add missing assertions for simple options
Byron Nov 10, 2022
d4089e7
fix docs
Byron Nov 10, 2022
a44c9ea
implement a couple of http values, needs some refactoring
Byron Nov 11, 2022
e3a24e6
refactor
Byron Nov 11, 2022
0ced3a4
refactor
Byron Nov 11, 2022
0ec5220
don't forget to update 'progress'
Byron Nov 11, 2022
585047b
First simple-http optiosn test passing
Byron Nov 11, 2022
3d9fb6c
update progress
Byron Nov 11, 2022
fe2042b
change!: `client::TransportWithoutIO::to_url()` returns `BString`.
Byron Nov 11, 2022
226f33a
adapt to changes in `git-transport`
Byron Nov 11, 2022
07512db
change!: `client::TransportWithoutIO::to_url()` returns `Cow<'_, BStr>`.
Byron Nov 11, 2022
f88569b
adjust for changes in `git-transport`
Byron Nov 11, 2022
ef64395
adjust for changes in `git-transport`
Byron Nov 11, 2022
9707f7f
extra-headers respects empty entries to clear the list
Byron Nov 11, 2022
375565f
Add `Debug` to `client::http::Options`
Byron Nov 11, 2022
b46e3bb
Set exact patch level for `git-transport`
Byron Nov 11, 2022
db9040f
feat!: add `remote::Connection::with_transport_config()`, change the …
Byron Nov 11, 2022
1553308
thanks clippy
Byron Nov 11, 2022
1236cf2
Currently http transport is only available for blocking io
Byron Nov 11, 2022
84f12b4
Remove redundant configuration of `git-transport` via top-level Cargo…
Byron Nov 11, 2022
e93768b
refactor
Byron Nov 11, 2022
d302c67
lenient support for all values that could previously fail
Byron Nov 13, 2022
4a29331
support for handling of illformed UTF-8
Byron Nov 13, 2022
1b53efb
leniency for all UTF-8 conversion failures
Byron Nov 13, 2022
32b1ba9
fix build warnings
Byron Nov 13, 2022
f4ff821
Merge branch 'main' into http-config
Byron Nov 15, 2022
21f3283
Empty proxies can disable the proxy; cleanup test fixture, let it hav…
Byron Nov 15, 2022
717b09f
Set curl `proxy-type` similar to how git does it
Byron Nov 15, 2022
70303c1
Add proxy-prefix and explicitly allow empty proxy values
Byron Nov 15, 2022
ee0276c
Set TCP keepalive just like `git` does
Byron Nov 15, 2022
f0625de
keep track of `no_proxy` environment variable support
Byron Nov 15, 2022
1766568
Avoid hardcoding some arbitrary default for connect timeouts, use cur…
Byron Nov 15, 2022
2ab80e4
Introduce new `gitoxide.http.connectTimeout` for more control for git…
Byron Nov 15, 2022
e055617
Also read the connectTimeout in simple HTTP options
Byron Nov 15, 2022
b5ca8a6
refactor
Byron Nov 15, 2022
a59c791
Make application of lenient configuration values way easier and nicer…
Byron Nov 15, 2022
db7ad53
refactor
Byron Nov 15, 2022
3577aef
feat: `Default` implementation for `Boolean` and `Integer`
Byron Nov 15, 2022
c76572b
Document that histogram is now the default diff algorithm
Byron Nov 15, 2022
9ff64bb
use convenience traits everywhere when applying leniency
Byron Nov 15, 2022
8eec815
fix warnings
Byron Nov 15, 2022
bbdb480
feat: higher performance for edits which would write the same value. …
Byron Nov 15, 2022
5f7fe69
thanks clippy
Byron Nov 15, 2022
e86e159
feat: `file::Transaction::rollback()` allows to explicitly roll back …
Byron Nov 16, 2022
b0a231a
refactor
Byron Nov 16, 2022
063ab73
Attempt to add the first case-sensitive test… (#595)
Byron Nov 16, 2022
3f54ade
First test to validate how collisions are expressed. (#595)
Byron Nov 16, 2022
e7bc5f2
remove unused and empty file
Byron Nov 16, 2022
27386a9
fix: loose ref iteration on a repo with missing 'ref/' fails when cre…
Byron Nov 16, 2022
e9853dd
fix: instead of erroring if loose iteration is performed on missing b…
Byron Nov 16, 2022
9f84850
fix: case-insentively conflicting references can be created even on c…
Byron Nov 16, 2022
66b053d
Avoid lock-acquisition for refs which are to be deleted if a global l…
Byron Nov 16, 2022
c1d2aea
refactor
Byron Nov 16, 2022
f17c6b6
refactor
Byron Nov 16, 2022
130d13b
Assure reflogs aren't skipped just because there is no per-loose lock…
Byron Nov 16, 2022
584b705
fix: assure symrefs don't get deleted when moving refs to packed-refs…
Byron Nov 16, 2022
25dcae7
Assure clones write their refs into packed-refs right away.
Byron Nov 16, 2022
fe7d6f9
thanks clippy
Byron Nov 16, 2022
58e1488
feat: `Id` implements `std::fmt::Display`
Byron Nov 17, 2022
00f6f7a
Don't assert on state that is based on a transaction that isn't commi…
Byron Nov 17, 2022
7691353
prepare for handshake generalization by copying it into position; par…
Byron Nov 17, 2022
611a139
migrate independent parts of ref parsing to generalized handshake.
Byron Nov 17, 2022
a3bcf82
change!: `handshake(…)` is now generalized to support `git-receive-pa…
Byron Nov 17, 2022
d0915b6
mention 'towards 1.0' tracking issues
Byron Nov 17, 2022
c421187
adapt to changes in `git-protocol`
Byron Nov 17, 2022
a03f8f6
change!: move `fetch::agent|indicate_end_of_interaction` to crate root
Byron Nov 17, 2022
35f7b4d
change!: move `fetch::Command` into the crate root.
Byron Nov 17, 2022
09070a7
change!: move `fetch::refs(…, protocol, …)` to the crate root as `ls_…
Byron Nov 17, 2022
bd70847
adapt to changes in `git-protocol`
Byron Nov 17, 2022
c32663e
adapt to changes in `git-protocol`
Byron Nov 17, 2022
b5c316e
fix docs
Byron Nov 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ gitoxide-core-tools = ["gitoxide-core/organize", "gitoxide-core/estimate-hours"]
## Use blocking client networking.
gitoxide-core-blocking-client = ["gitoxide-core/blocking-client"]
## Support synchronous 'http' and 'https' transports (e.g. for clone, fetch and push) at the expense of compile times and binary size.
http-client-curl = ["git-transport-for-configuration-only/http-client-curl"]
http-client-curl = ["git-repository/blocking-http-transport"]
## Use async client networking.
gitoxide-core-async-client = ["gitoxide-core/async-client", "futures-lite"]

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

git-transport-for-configuration-only = { package = "git-transport", optional = true, version = "^0.21.2", path = "git-transport" }

clap = { version = "3.2.5", features = ["derive", "cargo"] }
prodash = { version = "21", optional = true, default-features = false }
atty = { version = "0.2.14", optional = true, default-features = false }
Expand Down
1 change: 1 addition & 0 deletions STABILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ How do we avoid staying in the initial development phase (IDP) forever?

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

- _Is everything in it's tracking issue named "`<crate-name>` towards 1.0" resolved?_
- _Does the crate fulfill its intended purpose well enough?_
- _Do the dependent workspace crates fulfill their intended purposes well enough?_
- _Do they hide types and functionality of lower-tier workspace crates and external IDP crates?_
Expand Down
4 changes: 2 additions & 2 deletions git-config-value/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct Color {
/// suffix after fetching the value. [`integer::Suffix`] provides
/// [`bitwise_offset()`][integer::Suffix::bitwise_offset] to help with the
/// math, or [to_decimal()][Integer::to_decimal()] for obtaining a usable value in one step.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub struct Integer {
/// The value, without any suffix modification
pub value: i64,
Expand All @@ -34,7 +34,7 @@ pub struct Integer {
}

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

Expand Down
1 change: 0 additions & 1 deletion git-glob/tests/matching/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion git-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ required-features = ["async-client"]

[dependencies]
git-features = { version = "^0.23.1", path = "../git-features", features = ["progress"] }
git-transport = { version = "^0.21.1", path = "../git-transport" }
git-transport = { version = "^0.21.2", path = "../git-transport" }
git-hash = { version = "^0.9.11", path = "../git-hash" }
git-credentials = { version = "^0.6.1", path = "../git-credentials" }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
/// The kind of command to invoke on the server side.
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
pub enum Command {
/// List references.
LsRefs,
/// Fetch a pack.
Fetch,
}
//! V2 command abstraction to validate invocations and arguments, like a database of what we know about them.
use super::Command;
use std::borrow::Cow;

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

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

use crate::fetch::{agent, command::Feature, Command};
use crate::{command::Feature, Command};

impl Command {
/// Only V2
Expand Down Expand Up @@ -134,14 +129,13 @@ mod with_io {
feature => server_capabilities.contains(feature),
})
.map(|s| (s, None))
.chain(Some(agent()))
.collect()
}
git_transport::Protocol::V2 => {
let supported_features: Vec<_> = server_capabilities
.iter()
.find_map(|c| {
if c.name() == Command::Fetch.as_str().as_bytes().as_bstr() {
if c.name() == Command::Fetch.as_str() {
c.values().map(|v| v.map(|f| f.to_owned()).collect())
} else {
None
Expand All @@ -153,11 +147,10 @@ mod with_io {
.copied()
.filter(|feature| supported_features.iter().any(|supported| supported == feature))
.map(|s| (s, None))
.chain(Some(agent()))
.collect()
}
},
Command::LsRefs => vec![agent()],
Command::LsRefs => vec![],
}
}
/// Panics if the given arguments and features don't match what's statically known. It's considered a bug in the delegate.
Expand Down Expand Up @@ -212,3 +205,6 @@ mod with_io {
}
}
}

#[cfg(test)]
mod tests;
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ mod v1 {
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";
mod fetch {
mod default_features {
use crate::fetch::{
self,
tests::command::v1::{capabilities, GITHUB_CAPABILITIES},
Command,
};
use crate::command::tests::v1::{capabilities, GITHUB_CAPABILITIES};
use crate::Command;

#[test]
fn it_chooses_the_best_multi_ack_and_sideband() {
Expand All @@ -21,7 +18,7 @@ mod v1 {
git_transport::Protocol::V1,
&capabilities("multi_ack side-band side-band-64k multi_ack_detailed")
),
&[("side-band-64k", None), ("multi_ack_detailed", None), fetch::agent()]
&[("side-band-64k", None), ("multi_ack_detailed", None),]
);
}

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

mod fetch {
mod default_features {
use crate::fetch::{self, tests::command::v2::capabilities, Command};
use crate::command::tests::v2::capabilities;
use crate::Command;

#[test]
fn all_features() {
Expand All @@ -73,7 +70,6 @@ mod v2 {
["shallow", "filter", "ref-in-want", "sideband-all", "packfile-uris"]
.iter()
.map(|s| (*s, None))
.chain(Some(fetch::agent()))
.collect::<Vec<_>>()
)
}
Expand All @@ -82,7 +78,8 @@ mod v2 {
mod initial_arguments {
use bstr::ByteSlice;

use crate::fetch::{tests::command::v2::capabilities, Command};
use crate::command::tests::v2::capabilities;
use crate::Command;

#[test]
fn for_all_features() {
Expand All @@ -102,7 +99,8 @@ mod v2 {

mod ls_refs {
mod default_features {
use crate::fetch::{self, tests::command::v2::capabilities, Command};
use crate::command::tests::v2::capabilities;
use crate::Command;

#[test]
fn default_as_there_are_no_features() {
Expand All @@ -111,15 +109,16 @@ mod v2 {
git_transport::Protocol::V2,
&capabilities("something-else", "does not matter as there are none")
),
&[fetch::agent()]
&[]
);
}
}

mod validate {
use bstr::ByteSlice;

use crate::fetch::{tests::command::v2::capabilities, Command};
use crate::command::tests::v2::capabilities;
use crate::Command;

#[test]
fn ref_prefixes_can_always_be_used() {
Expand Down
3 changes: 2 additions & 1 deletion git-protocol/src/fetch/arguments/async_io.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use futures_lite::io::AsyncWriteExt;
use git_transport::{client, client::TransportV2Ext};

use crate::fetch::{Arguments, Command};
use crate::fetch::Arguments;
use crate::Command;

impl Arguments {
/// Send fetch arguments to the server, and indicate this is the end of negotiations only if `add_done_argument` is present.
Expand Down
7 changes: 5 additions & 2 deletions git-protocol/src/fetch/arguments/blocking_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::io::Write;

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

use crate::fetch::{Arguments, Command};
use crate::fetch::Arguments;
use crate::Command;

impl Arguments {
/// Send fetch arguments to the server, and indicate this is the end of negotiations only if `add_done_argument` is present.
Expand Down Expand Up @@ -45,7 +46,9 @@ impl Arguments {
}
transport.invoke(
Command::Fetch.as_str(),
self.features.iter().filter(|(_, v)| v.is_some()).cloned(),
self.features
.iter()
.filter_map(|(k, v)| v.as_ref().map(|v| (*k, Some(v.as_ref())))),
Some(std::mem::replace(&mut self.args, retained_state).into_iter()),
)
}
Expand Down
6 changes: 3 additions & 3 deletions git-protocol/src/fetch/arguments/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bstr::{BStr, BString, ByteSlice, ByteVec};
pub struct Arguments {
/// The active features/capabilities of the fetch invocation
#[cfg(any(feature = "async-client", feature = "blocking-client"))]
features: Vec<crate::fetch::command::Feature>,
features: Vec<crate::command::Feature>,

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