diff options
Diffstat (limited to 'vendor/gix-hash')
-rw-r--r-- | vendor/gix-hash/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-hash/CHANGELOG.md | 89 | ||||
-rw-r--r-- | vendor/gix-hash/Cargo.toml | 8 | ||||
-rw-r--r-- | vendor/gix-hash/src/object_id.rs | 25 | ||||
-rw-r--r-- | vendor/gix-hash/src/oid.rs | 4 | ||||
-rw-r--r-- | vendor/gix-hash/src/prefix.rs | 20 |
6 files changed, 120 insertions, 28 deletions
diff --git a/vendor/gix-hash/.cargo-checksum.json b/vendor/gix-hash/.cargo-checksum.json index 92ba33b52..17a023f80 100644 --- a/vendor/gix-hash/.cargo-checksum.json +++ b/vendor/gix-hash/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"2569a30769e7ce8b1d892e93a77a1201fd9665a458f7403464ad7662cffd64b5","Cargo.toml":"9ade9b3487cc51e0b8485c048057169dacccd4f56f5c608d6f659b49430b33f5","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/kind.rs":"b76634865925155fddcf10a94ec37f08be8a61855438ce2577566fda816006f0","src/lib.rs":"9079b3ac1e6471a5fd05dbea751d1ef29bea008be3d2a11978d1ead757441c56","src/object_id.rs":"c9ca58241acd05702f54ab6b3ab642d696d61b3ddf818b89c61817dd58177614","src/oid.rs":"90db69ca5bebd181db5ea6bc614f1a9c888ffc1779b74388652ea8e00aaec5c0","src/prefix.rs":"fb19dbd908bbf5bbb4af1541c9fe0f64d09ad1b01eb3a4b59eb2d0c35454d92e"},"package":"a0dd58cdbe7ffa4032fc111864c80d5f8cecd9a2c9736c97ae7e5be834188272"}
\ No newline at end of file +{"files":{"CHANGELOG.md":"a6b8740d3509850b2673eb8ca4eef60513a7525cd7818324c53247af0cda4389","Cargo.toml":"46d309d485955146ed1a5afc19bb024b9b174bfefa490c16324c9dcba28297fc","LICENSE-APACHE":"cb4780590812826851ba250f90bed0ed19506ec98f6865a0e2e20bbf62391ff9","LICENSE-MIT":"49df47913ab2beafe8dc45607877ae64198bf0eee64aaad3e82ed9e4d27424e8","src/kind.rs":"b76634865925155fddcf10a94ec37f08be8a61855438ce2577566fda816006f0","src/lib.rs":"9079b3ac1e6471a5fd05dbea751d1ef29bea008be3d2a11978d1ead757441c56","src/object_id.rs":"086df4c0ef60091aab53010061a6fbeecc655994a1d792106c1ea37ef7ef2449","src/oid.rs":"6b3bc5808b1220ebfa32c137024112d1162df88e5dede117fb6ecaa21867092b","src/prefix.rs":"d9281644da9ec8939452cb4ad42aa7229c754e32ad45e6d3b7f82b7ec868b092"},"package":"2ccf425543779cddaa4a7c62aba3fa9d90ea135b160be0a72dd93c063121ad4a"}
\ No newline at end of file diff --git a/vendor/gix-hash/CHANGELOG.md b/vendor/gix-hash/CHANGELOG.md index d8aab5343..86d3693b5 100644 --- a/vendor/gix-hash/CHANGELOG.md +++ b/vendor/gix-hash/CHANGELOG.md @@ -5,6 +5,92 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.13.0 (2023-09-08) + +### Bug Fixes (BREAKING) + + - <csr-id-072ee32f693a31161cd6a843da6582d13efbb20b/> use `dyn` trait where possible. + This reduces compile time due to avoiding duplication. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 commits contributed to the release over the course of 17 calendar days. + - 17 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Prepare changelogs for release ([`375db06`](https://github.com/Byron/gitoxide/commit/375db06a8442378c3f7a922fae38e2a6694d9d04)) + - Merge branch `dyn`ification ([`f658fcc`](https://github.com/Byron/gitoxide/commit/f658fcc52dc2200ae34ca53dc10be97fb9012057)) + - Use `dyn` trait where possible. ([`072ee32`](https://github.com/Byron/gitoxide/commit/072ee32f693a31161cd6a843da6582d13efbb20b)) + - Merge branch 'gix-submodule' ([`363ee77`](https://github.com/Byron/gitoxide/commit/363ee77400805f473c9ad66eadad9214e7ab66f4)) +</details> + +## 0.12.0 (2023-08-22) + +### New Features (BREAKING) + + - <csr-id-bd86f838a304e154828fb3fa1403ea2b713f95a6/> improve hex-parsing performance. + This improvementment is measurable in real-world applications. + + The reason for the breaking change is that the error type changed + slightly. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 4 commits contributed to the release over the course of 5 calendar days. + - 30 days passed between releases. + - 1 commit was understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-date v0.7.3, gix-hash v0.12.0, gix-features v0.33.0, gix-actor v0.25.0, gix-object v0.35.0, gix-path v0.9.0, gix-glob v0.11.0, gix-quote v0.4.7, gix-attributes v0.17.0, gix-command v0.2.9, gix-packetline-blocking v0.16.5, gix-filter v0.3.0, gix-fs v0.5.0, gix-commitgraph v0.19.0, gix-hashtable v0.3.0, gix-revwalk v0.6.0, gix-traverse v0.31.0, gix-worktree-stream v0.3.0, gix-archive v0.3.0, gix-config-value v0.13.0, gix-tempfile v8.0.0, gix-lock v8.0.0, gix-ref v0.35.0, gix-sec v0.9.0, gix-config v0.28.0, gix-prompt v0.6.0, gix-url v0.22.0, gix-credentials v0.18.0, gix-diff v0.34.0, gix-discover v0.23.0, gix-ignore v0.6.0, gix-bitmap v0.2.7, gix-index v0.22.0, gix-mailmap v0.17.0, gix-negotiate v0.6.0, gix-pack v0.41.0, gix-odb v0.51.0, gix-pathspec v0.1.0, gix-packetline v0.16.5, gix-transport v0.35.0, gix-protocol v0.38.0, gix-revision v0.20.0, gix-refspec v0.16.0, gix-submodule v0.2.0, gix-worktree v0.24.0, gix-worktree-state v0.1.0, gix v0.52.0, gitoxide-core v0.31.0, gitoxide v0.29.0, safety bump 41 crates ([`30b2761`](https://github.com/Byron/gitoxide/commit/30b27615047692d3ced1b2d9c2ac15a80f79fbee)) + - Update changelogs prior to release ([`f23ea88`](https://github.com/Byron/gitoxide/commit/f23ea8828f2d9ba7559973daca388c9591bcc5fc)) + - Merge branch 'faster-hex' ([`4a4fa0f`](https://github.com/Byron/gitoxide/commit/4a4fa0fcdaa6e14b51d3f03f5d7c5b65042667bf)) + - Improve hex-parsing performance. ([`bd86f83`](https://github.com/Byron/gitoxide/commit/bd86f838a304e154828fb3fa1403ea2b713f95a6)) +</details> + +## 0.11.4 (2023-07-22) + +A maintenance release without user-facing changes. + +### Commit Statistics + +<csr-read-only-do-not-edit/> + + - 3 commits contributed to the release over the course of 1 calendar day. + - 30 days passed between releases. + - 0 commits were understood as [conventional](https://www.conventionalcommits.org). + - 0 issues like '(#ID)' were seen in commit messages + +### Commit Details + +<csr-read-only-do-not-edit/> + +<details><summary>view details</summary> + + * **Uncategorized** + - Release gix-date v0.7.1, gix-hash v0.11.4, gix-trace v0.1.3, gix-features v0.32.0, gix-actor v0.24.0, gix-validate v0.7.7, gix-object v0.33.0, gix-path v0.8.4, gix-glob v0.10.0, gix-quote v0.4.6, gix-attributes v0.15.0, gix-command v0.2.7, gix-packetline-blocking v0.16.3, gix-filter v0.1.0, gix-fs v0.4.0, gix-chunk v0.4.4, gix-commitgraph v0.18.0, gix-hashtable v0.2.4, gix-revwalk v0.4.0, gix-traverse v0.30.0, gix-worktree-stream v0.2.0, gix-archive v0.2.0, gix-config-value v0.12.4, gix-tempfile v7.0.1, gix-utils v0.1.5, gix-lock v7.0.2, gix-ref v0.33.0, gix-sec v0.8.4, gix-prompt v0.5.3, gix-url v0.21.0, gix-credentials v0.17.0, gix-diff v0.33.0, gix-discover v0.22.0, gix-ignore v0.5.0, gix-bitmap v0.2.6, gix-index v0.21.0, gix-mailmap v0.16.0, gix-negotiate v0.5.0, gix-pack v0.40.0, gix-odb v0.50.0, gix-packetline v0.16.4, gix-transport v0.34.0, gix-protocol v0.36.0, gix-revision v0.18.0, gix-refspec v0.14.0, gix-worktree v0.22.0, gix v0.49.1 ([`5cb3589`](https://github.com/Byron/gitoxide/commit/5cb3589b74fc5376e02cbfe151e71344e1c417fe)) + - Update changelogs prior to release ([`2fc66b5`](https://github.com/Byron/gitoxide/commit/2fc66b55097ed494b72d1af939ba5561f71fde97)) + - Update license field following SPDX 2.1 license expression standard ([`9064ea3`](https://github.com/Byron/gitoxide/commit/9064ea31fae4dc59a56bdd3a06c0ddc990ee689e)) +</details> + ## 0.11.3 (2023-06-22) A maintenance release without user-facing changes. @@ -13,7 +99,7 @@ A maintenance release without user-facing changes. <csr-read-only-do-not-edit/> - - 3 commits contributed to the release over the course of 5 calendar days. + - 4 commits contributed to the release over the course of 5 calendar days. - 15 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -25,6 +111,7 @@ A maintenance release without user-facing changes. <details><summary>view details</summary> * **Uncategorized** + - Release gix-date v0.6.0, gix-hash v0.11.3, gix-trace v0.1.1, gix-features v0.31.0, gix-actor v0.22.0, gix-path v0.8.2, gix-glob v0.9.0, gix-quote v0.4.5, gix-attributes v0.14.0, gix-chunk v0.4.3, gix-commitgraph v0.17.0, gix-config-value v0.12.2, gix-fs v0.3.0, gix-tempfile v7.0.0, gix-utils v0.1.3, gix-lock v7.0.0, gix-validate v0.7.6, gix-object v0.31.0, gix-ref v0.31.0, gix-sec v0.8.2, gix-config v0.24.0, gix-command v0.2.6, gix-prompt v0.5.2, gix-url v0.20.0, gix-credentials v0.16.0, gix-diff v0.31.0, gix-discover v0.20.0, gix-hashtable v0.2.2, gix-ignore v0.4.0, gix-bitmap v0.2.5, gix-revwalk v0.2.0, gix-traverse v0.28.0, gix-index v0.19.0, gix-mailmap v0.14.0, gix-negotiate v0.3.0, gix-pack v0.38.0, gix-odb v0.48.0, gix-packetline v0.16.3, gix-transport v0.33.0, gix-protocol v0.34.0, gix-revision v0.16.0, gix-refspec v0.12.0, gix-worktree v0.20.0, gix v0.47.0, gitoxide-core v0.29.0, gitoxide v0.27.0, safety bump 30 crates ([`ea9f942`](https://github.com/Byron/gitoxide/commit/ea9f9424e777f10da0e33bb9ffbbefd01c4c5a74)) - Prepare changelogs prior to release ([`18b0a37`](https://github.com/Byron/gitoxide/commit/18b0a371941aa2d4d62512437d5daa351ba99ffd)) - Merge branch 'corpus' ([`aa16c8c`](https://github.com/Byron/gitoxide/commit/aa16c8ce91452a3e3063cf1cf0240b6014c4743f)) - Change MSRV to 1.65 ([`4f635fc`](https://github.com/Byron/gitoxide/commit/4f635fc4429350bae2582d25de86429969d28f30)) diff --git a/vendor/gix-hash/Cargo.toml b/vendor/gix-hash/Cargo.toml index 15f5809d3..b3f515ac0 100644 --- a/vendor/gix-hash/Cargo.toml +++ b/vendor/gix-hash/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.65" name = "gix-hash" -version = "0.11.3" +version = "0.13.0" authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] include = [ "src/**/*", @@ -21,7 +21,7 @@ include = [ "CHANGELOG.md", ] description = "Borrowed and owned git hash digests used to identify git objects" -license = "MIT/Apache-2.0" +license = "MIT OR Apache-2.0" repository = "https://github.com/Byron/gitoxide" [package.metadata.docs.rs] @@ -40,8 +40,8 @@ doctest = false version = "0.2.0" optional = true -[dependencies.hex] -version = "0.4.2" +[dependencies.faster-hex] +version = "0.8.0" [dependencies.serde] version = "1.0.114" diff --git a/vendor/gix-hash/src/object_id.rs b/vendor/gix-hash/src/object_id.rs index 8bf19a744..fe1b2e9ba 100644 --- a/vendor/gix-hash/src/object_id.rs +++ b/vendor/gix-hash/src/object_id.rs @@ -40,8 +40,8 @@ pub mod decode { pub enum Error { #[error("A hash sized {0} hexadecimal characters is invalid")] InvalidHexEncodingLength(usize), - #[error("Invalid character {c} at position {index}")] - Invalid { c: char, index: usize }, + #[error("Invalid character encountered")] + Invalid, } /// Hash decoding @@ -50,16 +50,19 @@ pub mod decode { /// /// Such a buffer can be obtained using [`oid::write_hex_to(buffer)`][super::oid::write_hex_to()] pub fn from_hex(buffer: &[u8]) -> Result<ObjectId, Error> { - use hex::FromHex; match buffer.len() { - 40 => Ok(ObjectId::Sha1(<[u8; 20]>::from_hex(buffer).map_err( - |err| match err { - hex::FromHexError::InvalidHexCharacter { c, index } => Error::Invalid { c, index }, - hex::FromHexError::OddLength | hex::FromHexError::InvalidStringLength => { - unreachable!("BUG: This is already checked") - } - }, - )?)), + 40 => Ok({ + ObjectId::Sha1({ + let mut buf = [0; 20]; + faster_hex::hex_decode(buffer, &mut buf).map_err(|err| match err { + faster_hex::Error::InvalidChar => Error::Invalid, + faster_hex::Error::InvalidLength(_) => { + unreachable!("BUG: This is already checked") + } + })?; + buf + }) + }), len => Err(Error::InvalidHexEncodingLength(len)), } } diff --git a/vendor/gix-hash/src/oid.rs b/vendor/gix-hash/src/oid.rs index 45380caff..b105621cb 100644 --- a/vendor/gix-hash/src/oid.rs +++ b/vendor/gix-hash/src/oid.rs @@ -148,13 +148,13 @@ impl oid { #[must_use] pub fn hex_to_buf(&self, buf: &mut [u8]) -> usize { let num_hex_bytes = self.bytes.len() * 2; - hex::encode_to_slice(&self.bytes, &mut buf[..num_hex_bytes]).expect("to count correctly"); + faster_hex::hex_encode(&self.bytes, &mut buf[..num_hex_bytes]).expect("to count correctly"); num_hex_bytes } /// Write ourselves to `out` in hexadecimal notation. #[inline] - pub fn write_hex_to(&self, mut out: impl std::io::Write) -> std::io::Result<()> { + pub fn write_hex_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> { let mut hex = crate::Kind::hex_buf(); let hex_len = self.hex_to_buf(&mut hex); out.write_all(&hex[..hex_len]) diff --git a/vendor/gix-hash/src/prefix.rs b/vendor/gix-hash/src/prefix.rs index 166b3c3e7..c8e1b1847 100644 --- a/vendor/gix-hash/src/prefix.rs +++ b/vendor/gix-hash/src/prefix.rs @@ -28,8 +28,8 @@ pub mod from_hex { TooShort { hex_len: usize }, #[error("An id cannot be larger than {} chars in hex, but {hex_len} was requested", crate::Kind::longest().len_in_hex())] TooLong { hex_len: usize }, - #[error("Invalid character {c} at position {index}")] - Invalid { c: char, index: usize }, + #[error("Invalid hex character")] + Invalid, } } @@ -41,8 +41,7 @@ impl Prefix { /// /// For instance, with `hex_len` of 7 the resulting prefix is 3.5 bytes, or 3 bytes and 4 bits /// wide, with all other bytes and bits set to zero. - pub fn new(id: impl AsRef<oid>, hex_len: usize) -> Result<Self, Error> { - let id = id.as_ref(); + pub fn new(id: &oid, hex_len: usize) -> Result<Self, Error> { if hex_len > id.kind().len_in_hex() { Err(Error::TooLong { object_kind: id.kind(), @@ -95,7 +94,6 @@ impl Prefix { /// Create an instance from the given hexadecimal prefix `value`, e.g. `35e77c16` would yield a `Prefix` with `hex_len()` = 8. pub fn from_hex(value: &str) -> Result<Self, from_hex::Error> { - use hex::FromHex; let hex_len = value.len(); if hex_len > crate::Kind::longest().len_in_hex() { @@ -105,16 +103,20 @@ impl Prefix { }; let src = if value.len() % 2 == 0 { - Vec::from_hex(value) + let mut out = Vec::from_iter(std::iter::repeat(0).take(value.len() / 2)); + faster_hex::hex_decode(value.as_bytes(), &mut out).map(move |_| out) } else { + // TODO(perf): do without heap allocation here. let mut buf = [0u8; crate::Kind::longest().len_in_hex()]; buf[..value.len()].copy_from_slice(value.as_bytes()); buf[value.len()] = b'0'; - Vec::from_hex(&buf[..=value.len()]) + let src = &buf[..=value.len()]; + let mut out = Vec::from_iter(std::iter::repeat(0).take(src.len() / 2)); + faster_hex::hex_decode(src, &mut out).map(move |_| out) } .map_err(|e| match e { - hex::FromHexError::InvalidHexCharacter { c, index } => from_hex::Error::Invalid { c, index }, - hex::FromHexError::OddLength | hex::FromHexError::InvalidStringLength => panic!("This is already checked"), + faster_hex::Error::InvalidChar => from_hex::Error::Invalid, + faster_hex::Error::InvalidLength(_) => panic!("This is already checked"), })?; let mut bytes = ObjectId::null(crate::Kind::from_hex_len(value.len()).expect("hex-len is already checked")); |