Skip to content

Commit d45ca62

Browse files
committed
fix: put gix-credentials and gix-prompt behind the 'credentials' feature toggle.
They are also available when using https transports.
1 parent 92dd181 commit d45ca62

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

gix/Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ default = ["max-performance-safe", "comfort", "basic", "extras"]
5151
basic = ["blob-diff", "revision"]
5252

5353
## Various additional features and capabilities that are not necessarily part of what most users would need.
54-
extras = ["worktree-stream", "worktree-archive", "revparse-regex", "mailmap", "excludes", "attributes", "worktree-mutation"]
54+
extras = ["worktree-stream", "worktree-archive", "revparse-regex", "mailmap", "excludes", "attributes", "worktree-mutation", "credentials"]
5555

5656
## Various progress-related features that improve the look of progress message units.
5757
comfort = ["gix-features/progress-unit-bytes", "gix-features/progress-unit-human-numbers"]
@@ -61,6 +61,9 @@ comfort = ["gix-features/progress-unit-bytes", "gix-features/progress-unit-human
6161
#! A component is a distinct feature which may be comprised of one or more methods around a particular topic.
6262
#! Providers of libraries should only activate the components they need.
6363

64+
## Access to credential helpers, which provide credentials for URLs.
65+
credentials = ["dep:gix-credentials", "dep:gix-prompt"]
66+
6467
## Various ways to alter the worktree makeup by checkout and reset.
6568
worktree-mutation = ["attributes", "dep:gix-worktree-state"]
6669

@@ -100,11 +103,11 @@ worktree-archive = ["gix-archive", "worktree-stream", "attributes"]
100103
#! Making a choice here also affects which crypto-library ends up being used.
101104

102105
## Make `gix-protocol` available along with an async client.
103-
async-network-client = ["gix-protocol/async-client", "gix-pack/streaming-input", "attributes"]
106+
async-network-client = ["gix-protocol/async-client", "gix-pack/streaming-input", "attributes", "credentials"]
104107
## Use this if your crate uses `async-std` as runtime, and enable basic runtime integration when connecting to remote servers via the `git://` protocol.
105108
async-network-client-async-std = ["async-std", "async-network-client", "gix-transport/async-std"]
106109
## Make `gix-protocol` available along with a blocking client, providing access to the `file://`, git://` and `ssh://` transports.
107-
blocking-network-client = ["gix-protocol/blocking-client", "gix-pack/streaming-input", "attributes"]
110+
blocking-network-client = ["gix-protocol/blocking-client", "gix-pack/streaming-input", "attributes", "credentials"]
108111
## Stacks with `blocking-network-client` to provide support for HTTP/S using **curl**, and implies blocking networking as a whole, making the `https://` transport avaialble.
109112
blocking-http-transport-curl = ["blocking-network-client", "gix-transport/http-client-curl"]
110113
## Stacks with `blocking-network-client` to provide support for HTTP/S using **reqwest**, and implies blocking networking as a whole, making the `https://` transport avaialble.
@@ -169,7 +172,7 @@ serde = [ "dep:serde",
169172
"gix-revision/serde",
170173
"gix-worktree?/serde",
171174
"gix-commitgraph/serde",
172-
"gix-credentials/serde"]
175+
"gix-credentials?/serde"]
173176

174177
## Re-export the progress tree root which allows to obtain progress from various functions which take `impl gix::Progress`.
175178
## Applications which want to display progress will probably need this implementation.
@@ -212,8 +215,8 @@ gix-features = { version = "^0.33.0", path = "../gix-features", features = ["pro
212215
gix-trace = { version = "^0.1.3", path = "../gix-trace" }
213216

214217
gix-glob = { version = "^0.11.0", path = "../gix-glob" }
215-
gix-credentials = { version = "^0.18.0", path = "../gix-credentials" }
216-
gix-prompt = { version = "^0.6.0", path = "../gix-prompt" }
218+
gix-credentials = { version = "^0.18.0", path = "../gix-credentials", optional = true }
219+
gix-prompt = { version = "^0.6.0", path = "../gix-prompt", optional = true }
217220
gix-index = { version = "^0.23.1", path = "../gix-index" }
218221
gix-attributes = { version = "^0.17.0", path = "../gix-attributes", optional = true }
219222
gix-ignore = { version = "^0.6.0", path = "../gix-ignore", optional = true }

gix/src/config/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::{bstr::BString, repository::identity, Repository};
55

66
pub(crate) mod cache;
77
mod snapshot;
8+
#[cfg(feature = "credentials")]
89
pub use snapshot::credential_helpers;
910

1011
///
@@ -461,6 +462,7 @@ pub mod transport {
461462
key: Cow<'static, BStr>,
462463
},
463464
#[error("Could not configure the credential helpers for the authenticated proxy url")]
465+
#[cfg(feature = "credentials")]
464466
ConfigureProxyAuthenticate(#[from] crate::config::snapshot::credential_helpers::Error),
465467
#[error(transparent)]
466468
InvalidSslVersion(#[from] crate::config::ssl_version::Error),

gix/src/config/snapshot/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ mod _impls;
22
mod access;
33

44
///
5+
#[cfg(feature = "credentials")]
56
pub mod credential_helpers;

gix/src/env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub mod collate {
6565
#[error(transparent)]
6666
FindExistingRemote(#[from] crate::remote::find::existing::Error),
6767
#[error(transparent)]
68+
#[cfg(feature = "credentials")]
6869
CredentialHelperConfig(#[from] crate::config::credential_helpers::Error),
6970
#[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))]
7071
#[error(transparent)]

gix/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub use gix_actor as actor;
8080
#[cfg(feature = "attributes")]
8181
pub use gix_attributes as attrs;
8282
pub use gix_commitgraph as commitgraph;
83+
#[cfg(feature = "credentials")]
8384
pub use gix_credentials as credentials;
8485
pub use gix_date as date;
8586
pub use gix_features as features;
@@ -102,6 +103,7 @@ pub use gix_negotiate as negotiate;
102103
pub use gix_object as objs;
103104
pub use gix_object::bstr;
104105
pub use gix_odb as odb;
106+
#[cfg(feature = "credentials")]
105107
pub use gix_prompt as prompt;
106108
#[cfg(feature = "gix-protocol")]
107109
pub use gix_protocol as protocol;

gix/tests/repository/config/config_snapshot/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ use gix::config::tree::{Branch, Core, Key};
22

33
use crate::named_repo;
44

5+
#[cfg(feature = "credentials")]
6+
mod credential_helpers;
7+
58
#[test]
69
fn commit_auto_rollback() -> crate::Result {
710
let mut repo: gix::Repository = named_repo("make_basic_repo.sh")?;
@@ -127,5 +130,3 @@ fn apply_cli_overrides() -> crate::Result {
127130

128131
Ok(())
129132
}
130-
131-
mod credential_helpers;

justfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ check:
4747
if cargo tree -p gix --no-default-features -i gix-submodule 2>/dev/null; then false; else true; fi
4848
if cargo tree -p gix --no-default-features -i gix-pathspec 2>/dev/null; then false; else true; fi
4949
if cargo tree -p gix --no-default-features -i gix-filter 2>/dev/null; then false; else true; fi
50+
if cargo tree -p gix --no-default-features -i gix-credentials 2>/dev/null; then false; else true; fi
5051
cargo check --no-default-features --features lean
5152
cargo check --no-default-features --features lean-async
5253
cargo check --no-default-features --features max
@@ -124,6 +125,7 @@ check:
124125
cargo check -p gix --no-default-features --features excludes --tests
125126
cargo check -p gix --no-default-features --features attributes --tests
126127
cargo check -p gix --no-default-features --features worktree-mutation --tests
128+
cargo check -p gix --no-default-features --features credentials --tests
127129
cargo check -p gix --no-default-features
128130
cargo check -p gix-odb --features serde
129131
cargo check --no-default-features --features max-control

0 commit comments

Comments
 (0)