From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/gix-hash/.cargo-checksum.json | 2 +- vendor/gix-hash/CHANGELOG.md | 36 ++++++- vendor/gix-hash/Cargo.toml | 3 +- vendor/gix-hash/LICENSE-APACHE | 191 +++++++++++++++++++++++++++++++++++ vendor/gix-hash/LICENSE-MIT | 21 ++++ vendor/gix-hash/src/kind.rs | 10 +- vendor/gix-hash/src/lib.rs | 10 +- vendor/gix-hash/src/object_id.rs | 41 ++++---- vendor/gix-hash/src/oid.rs | 8 +- vendor/gix-hash/src/prefix.rs | 6 +- 10 files changed, 291 insertions(+), 37 deletions(-) create mode 100644 vendor/gix-hash/LICENSE-APACHE create mode 100644 vendor/gix-hash/LICENSE-MIT (limited to 'vendor/gix-hash') diff --git a/vendor/gix-hash/.cargo-checksum.json b/vendor/gix-hash/.cargo-checksum.json index f988d45fb..6e3bc395b 100644 --- a/vendor/gix-hash/.cargo-checksum.json +++ b/vendor/gix-hash/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"3792e871c424e63e48810ad1c81e1675ada9640872f209a576364e07ae6231d3","Cargo.toml":"b6a812ab0d28742d26a213190406b8e61e5aca570c16d517115948d2ef699d06","src/kind.rs":"9d056e9553b5aa0d1a6706f51f443b345d05a95059295b6dc675cb4d6dec0696","src/lib.rs":"48c925d07f6ab27e52496139ba134bb9a8c69f037c87cc97fd0ac6233314b4ec","src/object_id.rs":"8d085bd6047592eae5a07bde7bb18017df007bf4fb4b70302c59ea4e4ded813e","src/oid.rs":"c3555b317f21673158010d8bf351b6bbe11bc2a12c4a9170105184555c120805","src/prefix.rs":"5bf4e3dfc605569280054983c28d501a585ce04b6948babffea24e14925d526f"},"package":"078eec3ac2808cc03f0bddd2704cb661da5c5dc33b41a9d7947b141d499c7c42"} \ No newline at end of file +{"files":{"CHANGELOG.md":"c63bb56e90f1ed541ad93907fc9e637363fab75efa4d461f1d97c16f1e8edfef","Cargo.toml":"35ff2df9e355e3ba2f5c0502bfe1fdb1d0e28de601a258802e5b9633d80413d7","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":"ee181c85d3955f54c4426e6bfaeeada4428692e1a39b8788c2ac7785fc301dd8"} \ No newline at end of file diff --git a/vendor/gix-hash/CHANGELOG.md b/vendor/gix-hash/CHANGELOG.md index c46aa0ccf..6af4f7b9a 100644 --- a/vendor/gix-hash/CHANGELOG.md +++ b/vendor/gix-hash/CHANGELOG.md @@ -5,6 +5,39 @@ 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.11.2 (2023-06-06) + +### New Features + + - add `ObjectId::is_empty_tree()` as sybling of `::is_empty_blob()`. + +### Commit Statistics + + + + - 9 commits contributed to the release over the course of 12 calendar days. + - 40 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 + + + +
view details + + * **Uncategorized** + - Prepare changelogs prior to release ([`8f15cec`](https://github.com/Byron/gitoxide/commit/8f15cec1ec7d5a9d56bb158f155011ef2bb3539b)) + - Add `ObjectId::is_empty_tree()` as sybling of `::is_empty_blob()`. ([`8d645b0`](https://github.com/Byron/gitoxide/commit/8d645b0494bb0376358fcf6e57a37b865ca91a96)) + - Merge branch 'fix-docs' ([`420553a`](https://github.com/Byron/gitoxide/commit/420553a10d780e0b2dc466cac120989298a5f187)) + - Cleaning up documentation ([`2578e57`](https://github.com/Byron/gitoxide/commit/2578e576bfa365d194a23a1fb0bf09be230873de)) + - Merge branch 'auto-clippy' ([`dbf8aa1`](https://github.com/Byron/gitoxide/commit/dbf8aa19d19109195d0274928eae4b94f248cd88)) + - Auto-fix as many 'range-plus-one' lints as possible ([`4795fcf`](https://github.com/Byron/gitoxide/commit/4795fcf6adb06b792592a1b11a3f071e9d47b1ac)) + - Merge branch 'main' into auto-clippy ([`3ef5c90`](https://github.com/Byron/gitoxide/commit/3ef5c90aebce23385815f1df674c1d28d58b4b0d)) + - Merge branch 'blinxen/main' ([`9375cd7`](https://github.com/Byron/gitoxide/commit/9375cd75b01aa22a0e2eed6305fe45fabfd6c1ac)) + - Include license files in all crates ([`facaaf6`](https://github.com/Byron/gitoxide/commit/facaaf633f01c857dcf2572c6dbe0a92b7105c1c)) +
+ ## 0.11.1 (2023-04-26) A maintenance release without user-facing changes. @@ -13,7 +46,7 @@ A maintenance release without user-facing changes. - - 3 commits contributed to the release over the course of 4 calendar days. + - 4 commits contributed to the release over the course of 4 calendar days. - 7 days passed between releases. - 0 commits were understood as [conventional](https://www.conventionalcommits.org). - 0 issues like '(#ID)' were seen in commit messages @@ -31,6 +64,7 @@ A maintenance release without user-facing changes.
view details * **Uncategorized** + - Release gix-hash v0.11.1, gix-path v0.7.4, gix-glob v0.6.0, gix-attributes v0.11.0, gix-config-value v0.11.0, gix-fs v0.1.1, gix-tempfile v5.0.3, gix-utils v0.1.1, gix-lock v5.0.1, gix-object v0.29.1, gix-ref v0.28.0, gix-sec v0.7.0, gix-config v0.21.0, gix-prompt v0.4.0, gix-url v0.17.0, gix-credentials v0.13.0, gix-diff v0.29.0, gix-discover v0.17.0, gix-hashtable v0.2.0, gix-ignore v0.1.0, gix-bitmap v0.2.3, gix-traverse v0.25.0, gix-index v0.16.0, gix-mailmap v0.12.0, gix-pack v0.34.0, gix-odb v0.44.0, gix-packetline v0.16.0, gix-transport v0.30.0, gix-protocol v0.31.0, gix-revision v0.13.0, gix-refspec v0.10.0, gix-worktree v0.16.0, gix v0.44.0, safety bump 7 crates ([`91134a1`](https://github.com/Byron/gitoxide/commit/91134a11c8ba0e942f692488ec9bce9fa1086324)) - Prepare changelogs prior to release ([`30a1a71`](https://github.com/Byron/gitoxide/commit/30a1a71f36f24faac0e0b362ffdfedea7f9cdbf1)) - Merge branch 'fix-823' ([`6ebd61e`](https://github.com/Byron/gitoxide/commit/6ebd61e548a36a04e413ac725a03e607a3588334)) - Thanks clippy ([`14e64e7`](https://github.com/Byron/gitoxide/commit/14e64e74649cfb1f2f99da87015939af98fae5c8)) diff --git a/vendor/gix-hash/Cargo.toml b/vendor/gix-hash/Cargo.toml index 8a66164da..41fe15de6 100644 --- a/vendor/gix-hash/Cargo.toml +++ b/vendor/gix-hash/Cargo.toml @@ -13,10 +13,11 @@ edition = "2021" rust-version = "1.64" name = "gix-hash" -version = "0.11.1" +version = "0.11.2" authors = ["Sebastian Thiel "] include = [ "src/**/*", + "LICENSE-*", "CHANGELOG.md", ] description = "Borrowed and owned git hash digests used to identify git objects" diff --git a/vendor/gix-hash/LICENSE-APACHE b/vendor/gix-hash/LICENSE-APACHE new file mode 100644 index 000000000..a51f59a06 --- /dev/null +++ b/vendor/gix-hash/LICENSE-APACHE @@ -0,0 +1,191 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2018-2021 Sebastian Thiel, and [contributors](https://github.com/byron/gitoxide/contributors) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/gix-hash/LICENSE-MIT b/vendor/gix-hash/LICENSE-MIT new file mode 100644 index 000000000..b58e818f1 --- /dev/null +++ b/vendor/gix-hash/LICENSE-MIT @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018-2021 Sebastian Thiel, and [contributors](https://github.com/byron/gitoxide/contributors). + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/gix-hash/src/kind.rs b/vendor/gix-hash/src/kind.rs index 902cf705d..ee8600b1b 100644 --- a/vendor/gix-hash/src/kind.rs +++ b/vendor/gix-hash/src/kind.rs @@ -57,14 +57,14 @@ impl Kind { [0u8; Kind::longest().len_in_bytes()] } - /// Returns the amount of ascii-characters needed to encode this has in hex. + /// Returns the amount of bytes needed to encode this instance as hexadecimal characters. #[inline] pub const fn len_in_hex(&self) -> usize { match self { Kind::Sha1 => 40, } } - /// Returns the amount of bytes taken up by the hash of the current kind. + /// Returns the amount of bytes taken up by the hash of this instance. #[inline] pub const fn len_in_bytes(&self) -> usize { match self { @@ -73,7 +73,7 @@ impl Kind { } /// Returns the kind of hash that would fit the given `hex_len`, or `None` if there is no fitting hash. - /// Note that 0 as `hex_len` fits always yields Sha1. + /// Note that `0` as `hex_len` up to 40 always yields `Sha1`. #[inline] pub const fn from_hex_len(hex_len: usize) -> Option { Some(match hex_len { @@ -98,7 +98,7 @@ impl Kind { } } - /// Create a null-id of our hash kind. + /// Create a shared null-id of our hash kind. #[inline] pub fn null_ref(&self) -> &'static oid { match self { @@ -106,7 +106,7 @@ impl Kind { } } - /// Create a null-id of our hash kind. + /// Create an owned null-id of our hash kind. #[inline] pub const fn null(&self) -> ObjectId { match self { diff --git a/vendor/gix-hash/src/lib.rs b/vendor/gix-hash/src/lib.rs index 49940f48e..f4a8d3f23 100644 --- a/vendor/gix-hash/src/lib.rs +++ b/vendor/gix-hash/src/lib.rs @@ -1,6 +1,6 @@ //! This crate provides types for identifying git objects using a hash digest. //! -//! These are provided in borrowed versions as well as owned ones. +//! These are provided in [borrowed versions][oid] as well as an [owned one][ObjectId]. //! ## Feature Flags #![cfg_attr( feature = "document-features", @@ -19,8 +19,10 @@ pub use object_id::{decode, ObjectId}; /// pub mod prefix; -/// An partial owned hash possibly identifying an object uniquely, -/// whose non-prefix bytes are zeroed. +/// An partial, owned hash possibly identifying an object uniquely, whose non-prefix bytes are zeroed. +/// +/// An example would `0000000000000000000000000000000032bd3242`, where `32bd3242` is the prefix, +/// which would be able to match all hashes that *start with* `32bd3242`. #[derive(PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy, Debug)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Prefix { @@ -31,7 +33,7 @@ pub struct Prefix { /// The size of a SHA1 hash digest in bytes. const SIZE_OF_SHA1_DIGEST: usize = 20; -/// Denotes the kind of function to produce a `Id`. +/// Denotes the kind of function to produce a [`ObjectId`]. #[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Kind { diff --git a/vendor/gix-hash/src/object_id.rs b/vendor/gix-hash/src/object_id.rs index 2d9bcef33..8bf19a744 100644 --- a/vendor/gix-hash/src/object_id.rs +++ b/vendor/gix-hash/src/object_id.rs @@ -1,14 +1,13 @@ use std::{ borrow::Borrow, convert::TryInto, - fmt, hash::{Hash, Hasher}, ops::Deref, }; use crate::{borrowed::oid, Kind, SIZE_OF_SHA1_DIGEST}; -/// An owned hash identifying objects, most commonly Sha1 +/// An owned hash identifying objects, most commonly `Sha1` #[derive(PartialEq, Eq, Ord, PartialOrd, Clone, Copy)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum ObjectId { @@ -77,11 +76,11 @@ pub mod decode { /// Access and conversion impl ObjectId { - /// Returns the kind of hash used in this `Id`. + /// Returns the kind of hash used in this instance. #[inline] - pub fn kind(&self) -> crate::Kind { + pub fn kind(&self) -> Kind { match self { - ObjectId::Sha1(_) => crate::Kind::Sha1, + ObjectId::Sha1(_) => Kind::Sha1, } } /// Return the raw byte slice representing this hash. @@ -119,7 +118,15 @@ impl ObjectId { } } - /// Returns true if this hash consists of all null bytes. + /// Returns an instances whose bytes are all zero. + #[inline] + pub const fn null(kind: Kind) -> ObjectId { + match kind { + Kind::Sha1 => Self::null_sha1(), + } + } + + /// Returns `true` if this hash consists of all null bytes. #[inline] pub fn is_null(&self) -> bool { match self { @@ -133,12 +140,10 @@ impl ObjectId { self == &Self::empty_blob(self.kind()) } - /// Returns an Digest representing a hash with whose memory is zeroed. + /// Returns `true` if this hash is equal to an empty tree. #[inline] - pub const fn null(kind: crate::Kind) -> ObjectId { - match kind { - crate::Kind::Sha1 => Self::null_sha1(), - } + pub fn is_empty_tree(&self) -> bool { + self == &Self::empty_tree(self.kind()) } } @@ -194,10 +199,10 @@ impl From<&[u8]> for ObjectId { } } -impl From<&crate::oid> for ObjectId { +impl From<&oid> for ObjectId { fn from(v: &oid) -> Self { match v.kind() { - crate::Kind::Sha1 => ObjectId::from_20_bytes(v.as_bytes()), + Kind::Sha1 => ObjectId::from_20_bytes(v.as_bytes()), } } } @@ -210,25 +215,25 @@ impl Deref for ObjectId { } } -impl AsRef for ObjectId { +impl AsRef for ObjectId { fn as_ref(&self) -> &oid { oid::from_bytes_unchecked(self.as_slice()) } } -impl Borrow for ObjectId { +impl Borrow for ObjectId { fn borrow(&self) -> &oid { self.as_ref() } } -impl fmt::Display for ObjectId { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +impl std::fmt::Display for ObjectId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.to_hex()) } } -impl PartialEq<&crate::oid> for ObjectId { +impl PartialEq<&oid> for ObjectId { fn eq(&self, other: &&oid) -> bool { self.as_ref() == *other } diff --git a/vendor/gix-hash/src/oid.rs b/vendor/gix-hash/src/oid.rs index 20d4fb4b6..45380caff 100644 --- a/vendor/gix-hash/src/oid.rs +++ b/vendor/gix-hash/src/oid.rs @@ -11,7 +11,7 @@ use crate::{ObjectId, SIZE_OF_SHA1_DIGEST}; /// internal `bytes` slice length (a fat pointer, pointing to data and its length in bytes) /// to encode additional information. Before accessing or returning the bytes, a new adjusted /// slice will be constructed, while the high bits will be used to help resolving the -/// hash `[`kind()`][oid::kind()]`. +/// hash [`kind()`][oid::kind()]. /// We expect to have quite a few bits available for such 'conflict resolution' as most hashes aren't longer /// than 64 bytes. #[derive(PartialEq, Eq, Ord, PartialOrd)] @@ -102,13 +102,13 @@ impl oid { /// Access impl oid { - /// The kind of hash used for this Digest. + /// The kind of hash used for this instance. #[inline] pub fn kind(&self) -> crate::Kind { crate::Kind::from_len_in_bytes(self.bytes.len()) } - /// The first byte of the hash, commonly used to partition a set of `Id`s. + /// The first byte of the hash, commonly used to partition a set of object ids. #[inline] pub fn first_byte(&self) -> u8 { self.bytes[0] @@ -206,7 +206,7 @@ impl PartialEq for &oid { /// Manually created from a version that uses a slice, and we forcefully try to convert it into a borrowed array of the desired size /// Could be improved by fitting this into serde. -/// Unfortunately the serde::Deserialize derive wouldn't work for borrowed arrays. +/// Unfortunately the `serde::Deserialize` derive wouldn't work for borrowed arrays. #[cfg(feature = "serde")] impl<'de: 'a, 'a> serde::Deserialize<'de> for &'a oid { fn deserialize(deserializer: D) -> Result>::Error> diff --git a/vendor/gix-hash/src/prefix.rs b/vendor/gix-hash/src/prefix.rs index a8b55922e..166b3c3e7 100644 --- a/vendor/gix-hash/src/prefix.rs +++ b/vendor/gix-hash/src/prefix.rs @@ -2,7 +2,7 @@ use std::{cmp::Ordering, convert::TryFrom}; use crate::{oid, ObjectId, Prefix}; -/// The error returned by [Prefix::new()]. +/// The error returned by [`Prefix::new()`]. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] pub enum Error { @@ -17,7 +17,7 @@ pub enum Error { /// pub mod from_hex { - /// The error returned by [Prefix::from_hex][super::Prefix::from_hex()]. + /// The error returned by [`Prefix::from_hex`][super::Prefix::from_hex()]. #[derive(Debug, Eq, PartialEq, thiserror::Error)] #[allow(missing_docs)] pub enum Error { @@ -110,7 +110,7 @@ impl Prefix { 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() + 1]) + Vec::from_hex(&buf[..=value.len()]) } .map_err(|e| match e { hex::FromHexError::InvalidHexCharacter { c, index } => from_hex::Error::Invalid { c, index }, -- cgit v1.2.3