Skip to content

Commit 72cf940

Browse files
committed
[git-protocol] build should fail if mutually exclusiive features are set
1 parent 6d2278b commit 72cf940

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ check: ## Build all code in suitable configurations
9999
&& cargo check \
100100
&& cargo check --features blocking-io \
101101
&& cargo check --features async-io
102-
cd git-protocol && cargo check --all-features \
103-
&& cargo check
104102
cd git-url && cargo check --all-features \
105103
&& cargo check
106104
cd git-features && cargo check --all-features \
@@ -123,9 +121,10 @@ check: ## Build all code in suitable configurations
123121
&& cargo check --features blocking-client \
124122
&& cargo check --features async-client \
125123
&& cargo check --features http-client-curl
126-
cd git-protocol && cargo check --all-features \
127-
&& cargo check \
128-
&& cargo check --features blocking-client
124+
cd git-protocol && cargo check \
125+
&& cargo check --features blocking-client \
126+
&& cargo check --features async-client
127+
cd git-protocol && if cargo check --all-features 2>/dev/null; then false; else true; fi
129128
cd git-repository && cargo check --all-features \
130129
&& cargo check --no-default-features
131130

git-protocol/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ doctest = false
1313

1414
[features]
1515
serde1 = ["serde", "bstr/serde1", "git-transport/serde1", "git-hash/serde1"]
16-
blocking-client = ["git-transport/blocking-client"]
16+
blocking-client = ["git-transport/blocking-client", "maybe-async/is_sync"]
1717
async-client = ["git-transport/async-client", "async-trait", "futures-io", "futures-lite"]
1818

1919
[[test]]
@@ -41,8 +41,8 @@ btoi = "0.4.2"
4141
async-trait = { version = "0.1.50", optional = true }
4242
futures-io = { version = "0.3.15", optional = true }
4343
futures-lite = { version = "1.12.0", optional = true }
44+
maybe-async = "0.2.6"
4445

4546
[dev-dependencies]
4647
async-std = { version = "1.9.0", features = ["attributes"] }
47-
maybe-async = "0.2.6"
4848
git-packetline = { version = "^0.6.0", path = "../git-packetline" }

git-protocol/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ pub mod fetch;
2626
#[doc(inline)]
2727
#[cfg(feature = "blocking-client")]
2828
pub use fetch::fetch;
29+
30+
#[cfg(all(feature = "blocking-client", feature = "async-client"))]
31+
compile_error!("Cannot set both 'blocking-client' and 'async-client' features as they are mutually exclusive");

0 commit comments

Comments
 (0)