Skip to content

Commit e4439aa

Browse files
committed
change!: move hashing API to gix_hash
1 parent baa1430 commit e4439aa

File tree

5 files changed

+4
-45
lines changed

5 files changed

+4
-45
lines changed

Cargo.lock

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

gix-features/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ progress = ["prodash"]
2424
## Provide human-readable numbers as well as easier to read byte units for progress bars.
2525
progress-unit-human-numbers = ["prodash?/unit-human"]
2626
## Provide human readable byte units for progress bars.
27-
progress-unit-bytes = ["dep:bytesize", "prodash?/unit-bytes", "gix-hash/progress-unit-bytes"]
27+
progress-unit-bytes = ["dep:bytesize", "prodash?/unit-bytes"]
2828

2929
## Provide utilities suitable for working with the `std::fs::read_dir()`.
3030
fs-read-dir = ["dep:gix-utils"]
@@ -107,7 +107,6 @@ path = "tests/pipe.rs"
107107
required-features = ["io-pipe"]
108108

109109
[dependencies]
110-
gix-hash = { version = "^0.16.0", path = "../gix-hash" }
111110
gix-trace = { version = "^0.1.12", path = "../gix-trace" }
112111

113112
# for walkdir

gix-features/src/hash.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
//! Hash functions and hash utilities
22
3-
// TODO: Remove this.
4-
#[cfg(any(feature = "rustsha1", feature = "fast-sha1"))]
5-
pub use gix_hash::hasher::{
6-
hasher,
7-
io::{bytes, bytes_of_file, bytes_with_hasher, Write},
8-
Digest, Hasher,
9-
};
10-
113
/// Compute a CRC32 hash from the given `bytes`, returning the CRC32 hash.
124
///
135
/// When calling this function for the first time, `previous_value` should be `0`. Otherwise it

gix-hash/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ doctest = false
1616
test = false
1717

1818
[features]
19-
# Temporary, to avoid a circular dependency on `gix-features`.
20-
progress-unit-bytes = ["prodash/unit-bytes"]
2119
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
2220
serde = ["dep:serde"]
2321

2422
[dependencies]
25-
# Temporary, to avoid a circular dependency on `gix-features`.
26-
prodash = "29.0.1"
23+
gix-features = { version = "^0.40.0", path = "../gix-features", features = ["progress"] }
2724

2825
thiserror = "2.0.0"
2926
faster-hex = { version = "0.9.0" }

gix-hash/src/hasher/io.rs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
use crate::{hasher, Hasher};
22

3-
// Temporary, to avoid a circular dependency on `gix-features`.
4-
///
5-
mod gix_features {
6-
///
7-
pub mod progress {
8-
pub use prodash::{self, unit, Progress, Unit};
9-
10-
///
11-
#[cfg(feature = "progress-unit-bytes")]
12-
pub fn bytes() -> Option<Unit> {
13-
Some(unit::dynamic_and_mode(
14-
unit::Bytes,
15-
unit::display::Mode::with_throughput().and_percentage(),
16-
))
17-
}
18-
19-
///
20-
#[cfg(not(feature = "progress-unit-bytes"))]
21-
pub fn bytes() -> Option<Unit> {
22-
Some(unit::label_and_mode(
23-
"B",
24-
unit::display::Mode::with_throughput().and_percentage(),
25-
))
26-
}
27-
}
28-
}
29-
303
/// Compute the hash of `kind` for the bytes in the file at `path`, hashing only the first `num_bytes_from_start`
314
/// while initializing and calling `progress`.
325
///
@@ -35,8 +8,7 @@ mod gix_features {
358
///
369
/// # Note
3710
///
38-
/// * Interrupts are supported.
39-
// TODO: Fix link to `gix_features::interrupt`.
11+
/// * [Interrupts][gix_features::interrupt] are supported.
4012
pub fn bytes_of_file(
4113
path: &std::path::Path,
4214
num_bytes_from_start: u64,

0 commit comments

Comments
 (0)