-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow using Cargo-as-a-library with gix's reqwest backend #15653
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
base: master
Are you sure you want to change the base?
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
@@ -271,10 +271,15 @@ test = false | |||
doc = false | |||
|
|||
[features] | |||
default = ["http-transport-curl"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any objection to this. Let me bring it to the Cargo team's meeting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Cargo team has discussed this today during the weekly meeting, and we agree this should be made optional.
Adding the feature to the default
feature is fine as well, since cargo
the library crate bumps its major version in each release.
In the future, we would like to see reqwest or other HTTP backends being options for the entire Cargo, not just for gix.
Thank you for the contribution. Could you rebase onto master so we can possibly merge it?
CI was trying to run |
What does this PR try to resolve?
Unconditionally enabling "blocking-http-transport-curl" made the
cargo
library incompatible with crates that prefer reqwest. An example being therustsec
crate with git support:Having
cargo
andrustsec
in the same dependency graph makesgix-transport
fail to compile.After this PR, dependency graphs that prefer reqwest can switch to Cargo's http-transport-reqwest feature.
Cargo will continue to have a direct dependency on
curl
, but HTTP operations performed through gix will usereqwest
. This means both curl's HTTP implementation and reqwest's HTTP implementation will be linked. This is still much better than the only existing solution, which is that you must pick versions ofcargo
and other dependency (rustsec
) which depend on semver-incompatible versions of gix, causing 2 entire versions of gix to be linked, in order to sidestep the mutually exclusive features being enabled on the same version of gix. Gix version numbers advance rapidly enough that this is often possible, but sometimes (like right now) you would be unable to use the most recent published release ofcargo
.How to test and review this PR?
cargo check --lib
cargo check --lib --no-default-features --features http-transport-reqwest
Also tested by backporting this commit onto #15391's base commit (i.e. when gix 0.70 was used) to ensure a conflict with rustsec's gix dependency, and successfully building the following project.