Skip to content

Commit e8bf096

Browse files
authored
Merge pull request GitoxideLabs#2441 from cruessler/remove-sha-1-from-default-features
Remove `sha1` from default features in `gix-hash`
2 parents f7b21ba + 3832916 commit e8bf096

File tree

46 files changed

+340
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+340
-72
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -558,22 +558,15 @@ jobs:
558558
gix-bitmap
559559
gix-chunk
560560
gix-command
561-
gix-commitgraph
562561
gix-config-value
563562
gix-date
564563
gix-glob
565-
gix-hash
566-
gix-hashtable
567564
gix-mailmap
568-
gix-object
569565
gix-packetline
570566
gix-path
571567
gix-pathspec
572568
gix-prompt
573569
gix-quote
574-
gix-refspec
575-
gix-revision
576-
gix-traverse
577570
gix-url
578571
gix-validate
579572
)
@@ -587,11 +580,26 @@ jobs:
587580
for feature in progress parallel io-pipe crc32 zlib cache-efficiency-debug; do
588581
cargo build -p gix-features --features "$feature" --target "$TARGET"
589582
done
590-
- name: crates with 'wasm' feature
583+
- name: crates with 'sha1' and 'wasm' feature
591584
run: |
592585
set -x
593586
for crate in gix-pack; do
594-
cargo build -p "$crate" --features wasm --target "$TARGET"
587+
cargo build -p "$crate" --features sha1,wasm --target "$TARGET"
588+
done
589+
- name: crates with 'sha1' feature
590+
run: |
591+
crates=(
592+
gix-commitgraph
593+
gix-hash
594+
gix-hashtable
595+
gix-object
596+
gix-refspec
597+
gix-revision
598+
gix-traverse
599+
)
600+
set -x
601+
for crate in "${crates[@]}"; do
602+
cargo build -p "$crate" --features sha1 --target "$TARGET"
595603
done
596604
- name: gix-pack with all features (including wasm)
597605
run: cargo build -p gix-pack --all-features --target "$TARGET"

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ default = ["max"]
4242
##
4343
## When used in conjunction with `http-client-curl-rustls`, the `openssl` crates will still be compiled, but won't be used. To bypass this, disable
4444
## default dependencies and specify the features yourself.
45-
max = ["max-control", "fast", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-blocking-client", "http-client-curl-openssl"]
45+
max = ["hashes", "max-control", "fast", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-blocking-client", "http-client-curl-openssl"]
4646

4747
## Like `max`, but only Rust is allowed.
4848
##
@@ -51,22 +51,23 @@ max = ["max-control", "fast", "gitoxide-core-tools-query", "gitoxide-core-tools-
5151
## This uses Rust's HTTP implementation.
5252
##
5353
## As fast as possible, with TUI progress, progress line rendering with auto-configuration, all transports available but less mature pure Rust HTTP implementation, all `ein` tools, CLI colors and local-time support, JSON output, regex support for rev-specs.
54-
max-pure = ["max-control", "http-client-reqwest", "gitoxide-core-blocking-client"]
54+
max-pure = ["hashes", "max-control", "http-client-reqwest", "gitoxide-core-blocking-client"]
5555

5656
## Like `max`, but with more control for configuration. See the *Package Maintainers* headline for more information.
57+
## Needs to chose its own hash(es).
5758
max-control = ["tracing", "fast", "pretty-cli", "gitoxide-core-tools", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure", "gix/revparse-regex"]
5859

5960
## All the good stuff, with less fanciness for smaller binaries.
6061
##
6162
## As fast as possible, progress line rendering, all transports based on their most mature implementation (HTTP), all `ein` tools, CLI colors and local-time support, JSON output.
62-
lean = ["fast", "tracing", "pretty-cli", "http-client-curl-openssl", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line"]
63+
lean = ["hashes", "fast", "tracing", "pretty-cli", "http-client-curl-openssl", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line"]
6364

6465
## The smallest possible build, best suitable for small single-core machines.
6566
##
6667
## This build is essentially limited to local operations without any fanciness. It does not have `gix clone`.
6768
##
6869
## Optimized for size, no parallelism thus much slower, progress line rendering.
69-
small = ["pretty-cli", "prodash-render-line", "is-terminal"]
70+
small = ["hashes", "pretty-cli", "prodash-render-line", "is-terminal"]
7071

7172
## Like lean, but uses Rusts async implementations for networking.
7273
##
@@ -77,7 +78,7 @@ small = ["pretty-cli", "prodash-render-line", "is-terminal"]
7778
##
7879
## Due to async client-networking not being implemented for most transports, this one supports only the 'git+tcp' and HTTP transport.
7980
## It uses, however, a fully asynchronous networking implementation which can serve a real-world example on how to implement custom async transports.
80-
lean-async = ["fast", "tracing", "pretty-cli", "gitoxide-core-tools", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-async-client", "prodash-render-line"]
81+
lean-async = ["hashes", "fast", "tracing", "pretty-cli", "gitoxide-core-tools", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-async-client", "prodash-render-line"]
8182

8283
#! ### Package Maintainers
8384
#! `*-control` features leave it to you to configure C libraries, involving choices for HTTP transport implementation.
@@ -88,6 +89,11 @@ lean-async = ["fast", "tracing", "pretty-cli", "gitoxide-core-tools", "gitoxide-
8889
#! ### Building Blocks
8990
#! Typical combinations of features of our dependencies, some of which are referred to in the `gitoxide` crate's code for conditional compilation.
9091

92+
## Provide support for all known hashes. If this isn't enabled, select an individual hash algorithms.
93+
hashes = ["sha1"]
94+
## Enable support for the SHA-1 hash throughout the `gix` crate.
95+
sha1 = ["gix/sha1"]
96+
9197
## Makes the crate execute as fast as possible by supporting parallel computation of otherwise long-running functions.
9298
## If disabled, the binary will be visibly smaller.
9399
fast = ["gix/max-performance", "gix/comfort"]

gitoxide-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ open = "5.0.0"
9595

9696
document-features = { version = "0.2.0", optional = true }
9797

98+
[dev-dependencies]
99+
gix = { path = "../gix", default-features = false, features = ["sha1"] }
100+
98101
[package.metadata.docs.rs]
99102
features = ["document-features", "blocking-client", "organize", "estimate-hours", "serde"]
100103

gix-archive/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ doctest = false
1616

1717
[features]
1818
default = ["tar", "tar_gz", "zip"]
19+
## Enable support for the SHA-1 hash by forwarding the feature to dependencies.
20+
sha1 = ["gix-worktree-stream/sha1", "gix-object/sha1"]
1921

2022
## Enable the `tar` archive format. It has support for all information, except for object ids.
2123
tar = ["dep:tar", "dep:gix-path"]
@@ -48,11 +50,11 @@ gix-odb = { path = "../gix-odb" }
4850
gix-worktree = { path = "../gix-worktree", default-features = false, features = [
4951
"attributes",
5052
] }
51-
gix-hash = { path = "../gix-hash" }
53+
gix-hash = { path = "../gix-hash", features = ["sha1"] }
5254
gix-attributes = { path = "../gix-attributes" }
5355
gix-object = { path = "../gix-object" }
5456
gix-filter = { path = "../gix-filter" }
5557

5658
[package.metadata.docs.rs]
5759
all-features = true
58-
features = ["document-features"]
60+
features = ["sha1", "document-features"]

gix-blame/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ authors = ["Christoph Rüßler <christoph.ruessler@mailbox.org>", "Sebastian Thi
1010
edition = "2021"
1111
rust-version = "1.82"
1212

13+
[features]
14+
## Enable support for the SHA-1 hash by forwarding the feature to dependencies.
15+
sha1 = [
16+
"gix-commitgraph/sha1",
17+
"gix-diff/sha1",
18+
"gix-hash/sha1",
19+
"gix-object/sha1",
20+
"gix-revwalk/sha1",
21+
"gix-traverse/sha1",
22+
"gix-worktree/sha1",
23+
]
24+
1325
[dependencies]
1426
gix-error = { version = "^0.2.0", path = "../gix-error" }
1527
gix-commitgraph = { version = "^0.34.0", path = "../gix-commitgraph" }
@@ -33,3 +45,6 @@ gix-index = { path = "../gix-index" }
3345
gix-odb = { path = "../gix-odb" }
3446
gix-testtools = { path = "../tests/tools" }
3547
pretty_assertions = "1.4.0"
48+
49+
[package.metadata.docs.rs]
50+
features = ["sha1"]

gix-commitgraph/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ rust-version = "1.82"
1616
doctest = false
1717

1818
[features]
19+
## Enable support for the SHA-1 hash by enabling the respective feature in the `gix-hash` crate.
20+
sha1 = ["gix-hash/sha1"]
1921
## Data structures implement `serde::Serialize` and `serde::Deserialize`
2022
serde = ["dep:serde", "gix-hash/serde", "bstr/serde"]
2123

@@ -34,11 +36,11 @@ document-features = { version = "0.2.0", optional = true }
3436
[dev-dependencies]
3537
gix-testtools = { path = "../tests/tools" }
3638
gix-date = { path = "../gix-date" }
37-
gix-hash = { path = "../gix-hash", features = ["sha256"] }
39+
gix-hash = { path = "../gix-hash", features = ["sha1", "sha256"] }
3840

3941
[package.metadata.docs.rs]
4042
all-features = true
41-
features = ["document-features"]
43+
features = ["sha1", "document-features"]
4244

4345
[package.metadata.cargo-machete]
4446
ignored = [

gix-commitgraph/fuzz/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ memmap2 = "0.9.0"
2121

2222
[dependencies.gix-commitgraph]
2323
path = ".."
24+
features = ["sha1"]
2425

2526
# Prevent this from interfering with workspaces
2627
[workspace]

gix-config/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ rust-version = "1.82"
1515
autotests = false
1616

1717
[features]
18+
## Enable support for the SHA-1 hash by forwarding the feature to dependencies.
19+
sha1 = ["gix-ref/sha1"]
1820
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
1921
serde = ["dep:serde", "bstr/serde", "gix-sec/serde", "gix-ref/serde", "gix-glob/serde", "gix-config-value/serde"]
2022

@@ -38,6 +40,7 @@ document-features = { version = "0.2.0", optional = true }
3840

3941
[dev-dependencies]
4042
criterion = "0.8.0"
43+
gix-config = { path = ".", features = ["sha1"] }
4144

4245
[[bench]]
4346
name = "large_config_file"
@@ -46,7 +49,7 @@ path = "./benches/large_config_file.rs"
4649

4750
[package.metadata.docs.rs]
4851
all-features = true
49-
features = ["document-features"]
52+
features = ["sha1", "document-features"]
5053

5154
[package.metadata.cargo-machete]
5255
ignored = [

gix-config/fuzz/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ anyhow = "1.0.76"
1616

1717
[dependencies.gix-config]
1818
path = ".."
19+
features = ["sha1"]
1920

2021
# Prevent this from interfering with workspaces
2122
[workspace]

0 commit comments

Comments
 (0)