Allow using Cargo-as-a-library with gix's reqwest backend #15653
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.