diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:50 +0000 |
commit | 9835e2ae736235810b4ea1c162ca5e65c547e770 (patch) | |
tree | 3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix-object | |
parent | Releasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff) | |
download | rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix-object')
-rw-r--r-- | vendor/gix-object/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/gix-object/Cargo.toml | 16 | ||||
-rw-r--r-- | vendor/gix-object/src/commit/message/body.rs | 4 | ||||
-rw-r--r-- | vendor/gix-object/src/commit/mod.rs | 4 | ||||
-rw-r--r-- | vendor/gix-object/src/commit/ref_iter.rs | 13 | ||||
-rw-r--r-- | vendor/gix-object/src/data.rs | 6 | ||||
-rw-r--r-- | vendor/gix-object/src/lib.rs | 41 | ||||
-rw-r--r-- | vendor/gix-object/src/tag/ref_iter.rs | 9 | ||||
-rw-r--r-- | vendor/gix-object/src/tree/mod.rs | 8 |
9 files changed, 51 insertions, 52 deletions
diff --git a/vendor/gix-object/.cargo-checksum.json b/vendor/gix-object/.cargo-checksum.json index 017dce937..a3f9a0fb6 100644 --- a/vendor/gix-object/.cargo-checksum.json +++ b/vendor/gix-object/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"3ea2cccf4c3923dad67e3d1000687675677980c14594d4dbe6c72c9bc450dc1a","src/blob.rs":"edbca29c4ec33e6791cc3730a70f38e8208e2e8eb1132059417886d05bab1bdd","src/commit/decode.rs":"38aa68f434af6e2512e5c13a12609d998cd5f44dcef0c5769c8f6ab387770b41","src/commit/message/body.rs":"a36f8b8730406db687b57bfcc63e48dbe9e87f1e34d422d32cd8cd2f79e21d83","src/commit/message/decode.rs":"87e517c3c43d016b576441e019882f90e2b8096a7c3bad0e97d8660a934b4a3d","src/commit/message/mod.rs":"c5c716b74dc042a26aef9ef0dfabbf9a0554259eb85548869d54ce122c1b7d69","src/commit/mod.rs":"0adbfc0b551b0a75493f3c298b17e43372c524b8dd120b5398e241db9cb22d6f","src/commit/ref_iter.rs":"345c46cbb746a50f33ccd27adea77cbfb14a7b3f97b3a6811ef3f9d7cf75b9ce","src/commit/write.rs":"e01189319e1fcb298abf0a2543a0e75e0ed359925090f14a8a6990cd9c536538","src/data.rs":"8032ccd01d2f62b44d899cb4e369d5ecc12c63ad99e13603e672d0d7ab24b651","src/encode.rs":"1be2616935ed333d8a7774debccc417b5d621c8ea30748768594706b813e7337","src/kind.rs":"1e47c1fa52d4dddf684976155f802af4acab6a1b055735604e7a4c0e44b5fd7c","src/lib.rs":"1e5f6957ab1c6458947898ad49c61618559f917f5fba594d529e45bda5e9bf4d","src/object/convert.rs":"5fa061ce08c12cd59cc5e6975c9e6b57a5ac596c5fe63eeb5758080e7dd7a328","src/object/mod.rs":"bf08ec2e20c1bc6f5eef49b16084c3ff86f44fed62276c7095e1a8ad315b4dfc","src/parse.rs":"da918868adb3ff7ea6212c284523028fb70ff7220a2fcd51eb3ab5a9b29658a5","src/tag/decode.rs":"77adf29167b2f6af9ed511881da2da244ac2284c97485ccae1fba985d3ff4fac","src/tag/mod.rs":"49743fd37efcafac49e693c54a0a304ad05dbe7b559e46c4fb29ef804e77a9b5","src/tag/ref_iter.rs":"b5eeee4c8f45893a860c693792f6221dbce569c4041e79f5c028726b3b06443d","src/tag/write.rs":"0eb21a3e12778051f880aedfe5838740a805bfedeec2bf3037a117ccc205717b","src/tag/write/tests.rs":"e3c3674d73d3436f10c268154b9362eb380ff9c014b6db2a141bd0a0747c4aff","src/traits.rs":"aa3fad21ffabad389584bb7254d60f4ef1b8165c7ef6e9967a133a1e35fd1fe1","src/tree/mod.rs":"7b832ed9bfaa8e8cdde2dad8f45237d39795543c6b1826922a6ebe964de9ffa1","src/tree/ref_iter.rs":"f2ea2f2af927a44def2795e0fe536c758f38a7a6f232802595f50d102a895ca6","src/tree/write.rs":"72a73ef01acd0c70cc596a68cf47cbaa9d83d118bcfb7eda7257c7d4a7260f44"},"package":"8df068db9180ee935fbb70504848369e270bdcb576b05c0faa8b9fd3b86fc017"}
\ No newline at end of file +{"files":{"Cargo.toml":"8a1f35d049bba69b1e819825701e2cdf392a8d8e4597ca93e5d8be2c7dde2164","src/blob.rs":"edbca29c4ec33e6791cc3730a70f38e8208e2e8eb1132059417886d05bab1bdd","src/commit/decode.rs":"38aa68f434af6e2512e5c13a12609d998cd5f44dcef0c5769c8f6ab387770b41","src/commit/message/body.rs":"dc5a3ec62cb87106a69e129c35a146e3807afacaee6c213120cf32d28e2c9f66","src/commit/message/decode.rs":"87e517c3c43d016b576441e019882f90e2b8096a7c3bad0e97d8660a934b4a3d","src/commit/message/mod.rs":"c5c716b74dc042a26aef9ef0dfabbf9a0554259eb85548869d54ce122c1b7d69","src/commit/mod.rs":"795bfd51cfba279f19eb0ba0da55e944e959c52476789cba7980c06bf1b1d545","src/commit/ref_iter.rs":"1c8aeeb9b15e9966e40bf81c769fde65b4885da4447d4596e8df872a0133bb06","src/commit/write.rs":"e01189319e1fcb298abf0a2543a0e75e0ed359925090f14a8a6990cd9c536538","src/data.rs":"552de5b87260936e69bff1ef2b6d93fe46d21bc05db84cac591caa0b5678bb95","src/encode.rs":"1be2616935ed333d8a7774debccc417b5d621c8ea30748768594706b813e7337","src/kind.rs":"1e47c1fa52d4dddf684976155f802af4acab6a1b055735604e7a4c0e44b5fd7c","src/lib.rs":"757827852d841325b0f5061ada56410787a90bef4822480ad594b37c0eeffd5d","src/object/convert.rs":"5fa061ce08c12cd59cc5e6975c9e6b57a5ac596c5fe63eeb5758080e7dd7a328","src/object/mod.rs":"bf08ec2e20c1bc6f5eef49b16084c3ff86f44fed62276c7095e1a8ad315b4dfc","src/parse.rs":"da918868adb3ff7ea6212c284523028fb70ff7220a2fcd51eb3ab5a9b29658a5","src/tag/decode.rs":"77adf29167b2f6af9ed511881da2da244ac2284c97485ccae1fba985d3ff4fac","src/tag/mod.rs":"49743fd37efcafac49e693c54a0a304ad05dbe7b559e46c4fb29ef804e77a9b5","src/tag/ref_iter.rs":"4d7809ab445f920ca41e9251205223a95dbf61f23435189d010694202927c196","src/tag/write.rs":"0eb21a3e12778051f880aedfe5838740a805bfedeec2bf3037a117ccc205717b","src/tag/write/tests.rs":"e3c3674d73d3436f10c268154b9362eb380ff9c014b6db2a141bd0a0747c4aff","src/traits.rs":"aa3fad21ffabad389584bb7254d60f4ef1b8165c7ef6e9967a133a1e35fd1fe1","src/tree/mod.rs":"2b4071ea469b629e969f815256beddd9a5ca222f03eec237807fb27d32e1335c","src/tree/ref_iter.rs":"f2ea2f2af927a44def2795e0fe536c758f38a7a6f232802595f50d102a895ca6","src/tree/write.rs":"72a73ef01acd0c70cc596a68cf47cbaa9d83d118bcfb7eda7257c7d4a7260f44"},"package":"c9bb30ce0818d37096daa29efe361a4bc6dd0b51a5726598898be7e9a40a01e1"}
\ No newline at end of file diff --git a/vendor/gix-object/Cargo.toml b/vendor/gix-object/Cargo.toml index 29185bb6b..c2c8fdbb7 100644 --- a/vendor/gix-object/Cargo.toml +++ b/vendor/gix-object/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.64" name = "gix-object" -version = "0.28.0" +version = "0.29.1" authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] include = ["src/**/*"] description = "Immutable and mutable git objects with decoding and encoding support" @@ -47,14 +47,14 @@ version = "0.2.0" optional = true [dependencies.gix-actor] -version = "^0.19.0" +version = "^0.20.0" [dependencies.gix-features] -version = "^0.28.0" +version = "^0.29.0" features = ["rustsha1"] [dependencies.gix-hash] -version = "^0.10.3" +version = "^0.11.1" [dependencies.gix-validate] version = "^0.7.3" @@ -87,11 +87,11 @@ version = "1.0.34" version = "1.0.0" [features] -serde1 = [ - "serde", +serde = [ + "dep:serde", "bstr/serde", "smallvec/serde", - "gix-hash/serde1", - "gix-actor/serde1", + "gix-hash/serde", + "gix-actor/serde", ] verbose-object-parsing-errors = ["nom/std"] diff --git a/vendor/gix-object/src/commit/message/body.rs b/vendor/gix-object/src/commit/message/body.rs index 27175a477..855f031be 100644 --- a/vendor/gix-object/src/commit/message/body.rs +++ b/vendor/gix-object/src/commit/message/body.rs @@ -22,10 +22,10 @@ pub struct Trailers<'a> { /// A trailer as parsed from the commit message body. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TrailerRef<'a> { /// The name of the trailer, like "Signed-off-by", up to the separator ": " - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] pub token: &'a BStr, /// The value right after the separator ": ", with leading and trailing whitespace trimmed. /// Note that multi-line values aren't currently supported. diff --git a/vendor/gix-object/src/commit/mod.rs b/vendor/gix-object/src/commit/mod.rs index 94e8e6ec0..9e135df28 100644 --- a/vendor/gix-object/src/commit/mod.rs +++ b/vendor/gix-object/src/commit/mod.rs @@ -10,10 +10,10 @@ pub mod message; /// /// Titles can have any amount of whitespace #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct MessageRef<'a> { /// The title of the commit, as separated from the body with two consecutive newlines. The newlines are not included. - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] pub title: &'a BStr, /// All bytes not consumed by the title, excluding the separating newlines. /// diff --git a/vendor/gix-object/src/commit/ref_iter.rs b/vendor/gix-object/src/commit/ref_iter.rs index d502bea73..313f90945 100644 --- a/vendor/gix-object/src/commit/ref_iter.rs +++ b/vendor/gix-object/src/commit/ref_iter.rs @@ -17,22 +17,19 @@ pub(crate) enum SignatureKind { Committer, } -#[derive(Copy, Clone)] +#[derive(Default, Copy, Clone)] pub(crate) enum State { + #[default] Tree, Parents, - Signature { of: SignatureKind }, + Signature { + of: SignatureKind, + }, Encoding, ExtraHeaders, Message, } -impl Default for State { - fn default() -> Self { - State::Tree - } -} - impl<'a> CommitRefIter<'a> { /// Create a commit iterator from data. pub fn from_bytes(data: &'a [u8]) -> CommitRefIter<'a> { diff --git a/vendor/gix-object/src/data.rs b/vendor/gix-object/src/data.rs index abf5e1377..e66360357 100644 --- a/vendor/gix-object/src/data.rs +++ b/vendor/gix-object/src/data.rs @@ -69,11 +69,7 @@ pub mod verify { /// hash of `self`. pub fn verify_checksum(&self, desired: impl AsRef<gix_hash::oid>) -> Result<(), Error> { let desired = desired.as_ref(); - let mut hasher = gix_features::hash::hasher(desired.kind()); - hasher.update(&crate::encode::loose_header(self.kind, self.data.len())); - hasher.update(self.data); - - let actual_id = gix_hash::ObjectId::from(hasher.digest()); + let actual_id = crate::compute_hash(desired.kind(), self.kind, self.data); if desired != actual_id { return Err(Error::ChecksumMismatch { desired: desired.into(), diff --git a/vendor/gix-object/src/lib.rs b/vendor/gix-object/src/lib.rs index 80273af9f..5f6f9d33a 100644 --- a/vendor/gix-object/src/lib.rs +++ b/vendor/gix-object/src/lib.rs @@ -38,7 +38,7 @@ pub(crate) mod parse; pub mod kind; /// The four types of objects that git differentiates. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)] #[allow(missing_docs)] pub enum Kind { @@ -49,7 +49,7 @@ pub enum Kind { } /// A chunk of any [`data`][BlobRef::data]. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct BlobRef<'a> { /// The bytes themselves. pub data: &'a [u8], @@ -57,7 +57,7 @@ pub struct BlobRef<'a> { /// A mutable chunk of any [`data`][Blob::data]. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Blob { /// The data itself. pub data: Vec<u8>, @@ -68,12 +68,12 @@ pub struct Blob { /// A commit encapsulates information about a point in time at which the state of the repository is recorded, usually after a /// change which is documented in the commit `message`. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct CommitRef<'a> { /// HEX hash of tree object we point to. Usually 40 bytes long. /// /// Use [`tree()`][CommitRef::tree()] to obtain a decoded version of it. - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] pub tree: &'a BStr, /// HEX hash of each parent commit. Empty for first commit in repository. pub parents: SmallVec<[&'a BStr; 1]>, @@ -106,7 +106,7 @@ pub struct CommitRefIter<'a> { /// A mutable git commit, representing an annotated state of a working tree along with a reference to its historical commits. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Commit { /// The hash of recorded working tree state. pub tree: gix_hash::ObjectId, @@ -130,10 +130,10 @@ pub struct Commit { /// Represents a git tag, commonly indicating a software release. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TagRef<'a> { /// The hash in hexadecimal being the object this tag points to. Use [`target()`][TagRef::target()] to obtain a byte representation. - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] pub target: &'a BStr, /// The kind of object that `target` points to. pub target_kind: Kind, @@ -157,7 +157,7 @@ pub struct TagRefIter<'a> { /// A mutable git tag. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Tag { /// The hash this tag is pointing to. pub target: gix_hash::ObjectId, @@ -181,10 +181,10 @@ pub struct Tag { /// /// An `ObjectRef` is representing [`Trees`][TreeRef], [`Blobs`][BlobRef], [`Commits`][CommitRef], or [`Tags`][TagRef]. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[allow(missing_docs)] pub enum ObjectRef<'a> { - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] Tree(TreeRef<'a>), Blob(BlobRef<'a>), Commit(CommitRef<'a>), @@ -200,7 +200,7 @@ pub enum ObjectRef<'a> { /// /// An `Object` is representing [`Trees`][Tree], [`Blobs`][Blob], [`Commits`][Commit] or [`Tags`][Tag]. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[allow(clippy::large_enum_variant, missing_docs)] pub enum Object { Tree(Tree), @@ -210,10 +210,10 @@ pub enum Object { } /// A directory snapshot containing files (blobs), directories (trees) and submodules (commits). #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TreeRef<'a> { /// The directories and files contained in this tree. - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] pub entries: Vec<tree::EntryRef<'a>>, } @@ -226,7 +226,7 @@ pub struct TreeRefIter<'a> { /// A mutable Tree, containing other trees, blobs or commits. #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Tree { /// The directories and files contained in this tree. They must be and remain sorted by [`filename`][tree::Entry::filename]. pub entries: Vec<tree::Entry>, @@ -375,3 +375,14 @@ pub mod decode { Ok((kind, size, size_end + 1)) } } + +/// A standalone function to compute a hash of kind `hash_kind` for an object of `object_kind` and its `data`. +pub fn compute_hash(hash_kind: gix_hash::Kind, object_kind: Kind, data: &[u8]) -> gix_hash::ObjectId { + let header = encode::loose_header(object_kind, data.len()); + + let mut hasher = gix_features::hash::hasher(hash_kind); + hasher.update(&header); + hasher.update(data); + + hasher.digest().into() +} diff --git a/vendor/gix-object/src/tag/ref_iter.rs b/vendor/gix-object/src/tag/ref_iter.rs index f9409ebbe..1138016b5 100644 --- a/vendor/gix-object/src/tag/ref_iter.rs +++ b/vendor/gix-object/src/tag/ref_iter.rs @@ -9,8 +9,9 @@ use nom::{ use crate::{bstr::ByteSlice, parse, parse::NL, tag::decode, Kind, TagRefIter}; -#[derive(Copy, Clone)] +#[derive(Default, Copy, Clone)] pub(crate) enum State { + #[default] Target, TargetKind, Name, @@ -18,12 +19,6 @@ pub(crate) enum State { Message, } -impl Default for State { - fn default() -> Self { - State::Target - } -} - impl<'a> TagRefIter<'a> { /// Create a tag iterator from data. pub fn from_bytes(data: &'a [u8]) -> TagRefIter<'a> { diff --git a/vendor/gix-object/src/tree/mod.rs b/vendor/gix-object/src/tree/mod.rs index 688689c08..be723e1b8 100644 --- a/vendor/gix-object/src/tree/mod.rs +++ b/vendor/gix-object/src/tree/mod.rs @@ -14,7 +14,7 @@ pub mod write; /// Used in [mutable::Entry][crate::tree::Entry] and [EntryRef]. #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash)] #[repr(u16)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum EntryMode { /// A tree, or directory Tree = 0o040000u16, @@ -64,7 +64,7 @@ impl EntryMode { /// An element of a [`TreeRef`][crate::TreeRef::entries]. #[derive(PartialEq, Eq, Debug, Hash, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct EntryRef<'a> { /// The kind of object to which `oid` is pointing. pub mode: tree::EntryMode, @@ -73,7 +73,7 @@ pub struct EntryRef<'a> { /// The id of the object representing the entry. // TODO: figure out how these should be called. id or oid? It's inconsistent around the codebase. // Answer: make it 'id', as in `git2` - #[cfg_attr(feature = "serde1", serde(borrow))] + #[cfg_attr(feature = "serde", serde(borrow))] pub oid: &'a gix_hash::oid, } @@ -94,7 +94,7 @@ impl<'a> Ord for EntryRef<'a> { /// An entry in a [`Tree`][crate::Tree], similar to an entry in a directory. #[derive(PartialEq, Eq, Debug, Hash, Clone)] -#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Entry { /// The kind of object to which `oid` is pointing to. pub mode: EntryMode, |