summaryrefslogtreecommitdiffstats
path: root/vendor/gix-pack/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/gix-pack/src
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-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-pack/src')
-rw-r--r--vendor/gix-pack/src/bundle/write/types.rs2
-rw-r--r--vendor/gix-pack/src/data/entry/header.rs2
-rw-r--r--vendor/gix-pack/src/data/entry/mod.rs2
-rw-r--r--vendor/gix-pack/src/data/file/decode/entry.rs4
-rw-r--r--vendor/gix-pack/src/data/file/decode/header.rs4
-rw-r--r--vendor/gix-pack/src/data/input/mod.rs2
-rw-r--r--vendor/gix-pack/src/data/input/types.rs4
-rw-r--r--vendor/gix-pack/src/data/mod.rs13
-rw-r--r--vendor/gix-pack/src/data/output/count/mod.rs4
-rw-r--r--vendor/gix-pack/src/data/output/count/objects/types.rs15
-rw-r--r--vendor/gix-pack/src/data/output/count/objects/util.rs2
-rw-r--r--vendor/gix-pack/src/data/output/entry/iter_from_counts.rs6
-rw-r--r--vendor/gix-pack/src/data/output/entry/mod.rs4
-rw-r--r--vendor/gix-pack/src/data/output/mod.rs4
-rw-r--r--vendor/gix-pack/src/find.rs2
-rw-r--r--vendor/gix-pack/src/index/access.rs2
-rw-r--r--vendor/gix-pack/src/index/mod.rs11
-rw-r--r--vendor/gix-pack/src/index/traverse/mod.rs6
-rw-r--r--vendor/gix-pack/src/index/traverse/types.rs24
-rw-r--r--vendor/gix-pack/src/index/verify.rs9
-rw-r--r--vendor/gix-pack/src/index/write/mod.rs2
-rw-r--r--vendor/gix-pack/src/multi_index/access.rs2
-rw-r--r--vendor/gix-pack/src/multi_index/mod.rs11
23 files changed, 49 insertions, 88 deletions
diff --git a/vendor/gix-pack/src/bundle/write/types.rs b/vendor/gix-pack/src/bundle/write/types.rs
index 56c14ac59..7bc4ec35f 100644
--- a/vendor/gix-pack/src/bundle/write/types.rs
+++ b/vendor/gix-pack/src/bundle/write/types.rs
@@ -31,7 +31,7 @@ impl Default for Options {
/// Returned by [write_to_directory][crate::Bundle::write_to_directory()] or
/// [write_to_directory_eagerly][crate::Bundle::write_to_directory_eagerly()]
#[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 Outcome {
/// The successful result of the index write operation
pub index: crate::index::write::Outcome,
diff --git a/vendor/gix-pack/src/data/entry/header.rs b/vendor/gix-pack/src/data/entry/header.rs
index 83983eab0..4d0dbf4d2 100644
--- a/vendor/gix-pack/src/data/entry/header.rs
+++ b/vendor/gix-pack/src/data/entry/header.rs
@@ -5,7 +5,7 @@ use crate::data;
/// The header portion of a pack data entry, identifying the kind of stored object.
#[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))]
#[allow(missing_docs)]
pub enum Header {
/// The object is a commit
diff --git a/vendor/gix-pack/src/data/entry/mod.rs b/vendor/gix-pack/src/data/entry/mod.rs
index f11c39c5c..6225cbf01 100644
--- a/vendor/gix-pack/src/data/entry/mod.rs
+++ b/vendor/gix-pack/src/data/entry/mod.rs
@@ -11,7 +11,7 @@ const REF_DELTA: u8 = 7;
/// A way to uniquely identify the location of an entry within a pack bundle
#[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 Location {
/// The id of the pack containing the object. It's unique within its frame of reference which is the owning object database.
pub pack_id: u32,
diff --git a/vendor/gix-pack/src/data/file/decode/entry.rs b/vendor/gix-pack/src/data/file/decode/entry.rs
index 60fefec0f..a467ccd8e 100644
--- a/vendor/gix-pack/src/data/file/decode/entry.rs
+++ b/vendor/gix-pack/src/data/file/decode/entry.rs
@@ -10,7 +10,7 @@ use crate::{
/// A return value of a resolve function, which given an [`ObjectId`][gix_hash::ObjectId] determines where an object can be found.
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ResolvedBase {
/// Indicate an object is within this pack, at the given entry, and thus can be looked up locally.
InPack(data::Entry),
@@ -34,7 +34,7 @@ struct Delta {
///
/// Useful to understand the effectiveness of the pack compression or the cost of decompression.
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Outcome {
/// The kind of resolved object.
pub kind: gix_object::Kind,
diff --git a/vendor/gix-pack/src/data/file/decode/header.rs b/vendor/gix-pack/src/data/file/decode/header.rs
index 1f4b1de0a..0afd6e52a 100644
--- a/vendor/gix-pack/src/data/file/decode/header.rs
+++ b/vendor/gix-pack/src/data/file/decode/header.rs
@@ -5,7 +5,7 @@ use crate::{
/// A return value of a resolve function, which given an [`ObjectId`][gix_hash::ObjectId] determines where an object can be found.
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ResolvedBase {
/// Indicate an object is within this pack, at the given entry, and thus can be looked up locally.
InPack(data::Entry),
@@ -22,7 +22,7 @@ pub enum ResolvedBase {
///
/// Useful to understand the effectiveness of the pack compression or the cost of decompression.
#[derive(Debug, PartialEq, Eq, 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 Outcome {
/// The kind of resolved object.
pub kind: gix_object::Kind,
diff --git a/vendor/gix-pack/src/data/input/mod.rs b/vendor/gix-pack/src/data/input/mod.rs
index df191de67..d3a36416e 100644
--- a/vendor/gix-pack/src/data/input/mod.rs
+++ b/vendor/gix-pack/src/data/input/mod.rs
@@ -1,6 +1,6 @@
/// An item of the iteration produced by [`BytesToEntriesIter`]
#[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 Entry {
/// The header of a pack entry
pub header: crate::data::entry::Header,
diff --git a/vendor/gix-pack/src/data/input/types.rs b/vendor/gix-pack/src/data/input/types.rs
index 6fcd459e2..86852479f 100644
--- a/vendor/gix-pack/src/data/input/types.rs
+++ b/vendor/gix-pack/src/data/input/types.rs
@@ -22,7 +22,7 @@ pub enum Error {
/// Iteration Mode
#[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 enum Mode {
/// Provide the trailer as read from the pack
AsIs,
@@ -43,7 +43,7 @@ pub enum Mode {
/// Define what to do with the compressed bytes portion of a pack [`Entry`][super::Entry]
#[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 enum EntryDataMode {
/// Do nothing with the compressed bytes we read
Ignore,
diff --git a/vendor/gix-pack/src/data/mod.rs b/vendor/gix-pack/src/data/mod.rs
index da717fc1a..36e01d779 100644
--- a/vendor/gix-pack/src/data/mod.rs
+++ b/vendor/gix-pack/src/data/mod.rs
@@ -11,7 +11,7 @@ use memmap2::Mmap;
/// An representing an full- or delta-object within a pack
#[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 Entry {
/// The entry's header
pub header: entry::Header,
@@ -48,20 +48,15 @@ pub mod output;
pub type EntryRange = std::ops::Range<Offset>;
/// Supported versions of a pack data file
-#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(missing_docs)]
pub enum Version {
+ #[default]
V2,
V3,
}
-impl Default for Version {
- fn default() -> Self {
- Version::V2
- }
-}
-
/// A pack data file
pub struct File {
data: Mmap,
diff --git a/vendor/gix-pack/src/data/output/count/mod.rs b/vendor/gix-pack/src/data/output/count/mod.rs
index e7ee767de..bec75d6f3 100644
--- a/vendor/gix-pack/src/data/output/count/mod.rs
+++ b/vendor/gix-pack/src/data/output/count/mod.rs
@@ -4,7 +4,7 @@ use crate::data::output::Count;
/// Specifies how the pack location was handled during counting
#[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 enum PackLocation {
/// We did not lookup this object
NotLookedUp,
@@ -30,7 +30,7 @@ impl PackLocation {
}
impl Count {
- /// Create a new instance from the given `oid` and its corresponding git `obj`ect data.
+ /// Create a new instance from the given `oid` and its corresponding location.
pub fn from_data(oid: impl Into<ObjectId>, location: Option<crate::data::entry::Location>) -> Self {
Count {
id: oid.into(),
diff --git a/vendor/gix-pack/src/data/output/count/objects/types.rs b/vendor/gix-pack/src/data/output/count/objects/types.rs
index 8c8c939df..cd9e92c7a 100644
--- a/vendor/gix-pack/src/data/output/count/objects/types.rs
+++ b/vendor/gix-pack/src/data/output/count/objects/types.rs
@@ -1,6 +1,6 @@
/// Information gathered during the run of [`iter_from_objects()`][super::objects()].
#[derive(Default, 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 Outcome {
/// The amount of objects provided to start the iteration.
pub input_objects: usize,
@@ -32,10 +32,11 @@ impl Outcome {
}
/// The way input objects are handled
-#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Default, PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ObjectExpansion {
/// Don't do anything with the input objects except for transforming them into pack entries
+ #[default]
AsIs,
/// If the input object is a Commit then turn it into a pack entry. Additionally obtain its tree, turn it into a pack entry
/// along with all of its contents, that is nested trees, and any other objects reachable from it.
@@ -52,15 +53,9 @@ pub enum ObjectExpansion {
TreeAdditionsComparedToAncestor,
}
-impl Default for ObjectExpansion {
- fn default() -> Self {
- ObjectExpansion::AsIs
- }
-}
-
/// Configuration options for the pack generation functions provided in [this module][crate::data::output].
#[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 Options {
/// The amount of threads to use at most when resolving the pack. If `None`, all logical cores are used.
/// If more than one thread is used, the order of returned [counts][crate::data::output::Count] is not deterministic anymore
diff --git a/vendor/gix-pack/src/data/output/count/objects/util.rs b/vendor/gix-pack/src/data/output/count/objects/util.rs
index a80841313..b1997e1c7 100644
--- a/vendor/gix-pack/src/data/output/count/objects/util.rs
+++ b/vendor/gix-pack/src/data/output/count/objects/util.rs
@@ -3,9 +3,9 @@ pub trait InsertImmutable {
}
mod trait_impls {
- use gix_hash::ObjectId;
use std::cell::RefCell;
+ use gix_hash::ObjectId;
use gix_hashtable::HashSet;
use super::InsertImmutable;
diff --git a/vendor/gix-pack/src/data/output/entry/iter_from_counts.rs b/vendor/gix-pack/src/data/output/entry/iter_from_counts.rs
index 25e256d5c..dbe8b0b95 100644
--- a/vendor/gix-pack/src/data/output/entry/iter_from_counts.rs
+++ b/vendor/gix-pack/src/data/output/entry/iter_from_counts.rs
@@ -317,7 +317,7 @@ mod types {
/// Information gathered during the run of [`iter_from_counts()`][crate::data::output::entry::iter_from_counts()].
#[derive(Default, 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 Outcome {
/// The amount of fully decoded objects. These are the most expensive as they are fully decoded.
pub decoded_and_recompressed_objects: usize,
@@ -349,7 +349,7 @@ mod types {
/// The way the iterator operates.
#[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 enum Mode {
/// Copy base objects and deltas from packs, while non-packed objects will be treated as base objects
/// (i.e. without trying to delta compress them). This is a fast way of obtaining a back while benefiting
@@ -360,7 +360,7 @@ mod types {
/// Configuration options for the pack generation functions provided in [`iter_from_counts()`][crate::data::output::entry::iter_from_counts()].
#[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 Options {
/// The amount of threads to use at most when resolving the pack. If `None`, all logical cores are used.
pub thread_limit: Option<usize>,
diff --git a/vendor/gix-pack/src/data/output/entry/mod.rs b/vendor/gix-pack/src/data/output/entry/mod.rs
index 401d2f24c..a94720047 100644
--- a/vendor/gix-pack/src/data/output/entry/mod.rs
+++ b/vendor/gix-pack/src/data/output/entry/mod.rs
@@ -10,7 +10,7 @@ pub use iter_from_counts::function::iter_from_counts;
/// The kind of pack entry to be written
#[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 enum Kind {
/// A complete base object, including its kind
Base(gix_object::Kind),
@@ -126,7 +126,7 @@ impl output::Entry {
})
}
- /// Create a new instance from the given `oid` and its corresponding git `obj`ect data.
+ /// Create a new instance from the given `oid` and its corresponding git object data `obj`.
pub fn from_data(count: &output::Count, obj: &gix_object::Data<'_>) -> Result<Self, Error> {
Ok(output::Entry {
id: count.id.to_owned(),
diff --git a/vendor/gix-pack/src/data/output/mod.rs b/vendor/gix-pack/src/data/output/mod.rs
index f94d32e8e..338bb92b3 100644
--- a/vendor/gix-pack/src/data/output/mod.rs
+++ b/vendor/gix-pack/src/data/output/mod.rs
@@ -8,7 +8,7 @@ pub mod count;
/// One can expect to have one of these in memory when building big objects, so smaller is better here.
/// They should contain everything of importance to generate a pack as fast as possible.
#[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 Count {
/// The hash of the object to write
pub id: ObjectId,
@@ -21,7 +21,7 @@ pub struct Count {
/// Some of these will be in-flight and in memory while waiting to be written. Memory requirements depend on the amount of compressed
/// data they hold.
#[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 Entry {
/// The hash of the object to write
pub id: ObjectId,
diff --git a/vendor/gix-pack/src/find.rs b/vendor/gix-pack/src/find.rs
index 8143692e7..2908669a2 100644
--- a/vendor/gix-pack/src/find.rs
+++ b/vendor/gix-pack/src/find.rs
@@ -53,7 +53,7 @@ pub mod existing_iter {
///
/// Its commonly retrieved by reading from a pack index file followed by a read from a pack data file.
#[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 struct Entry {
/// The pack-data encoded bytes of the pack data entry as present in the pack file, including the header followed by compressed data.
diff --git a/vendor/gix-pack/src/index/access.rs b/vendor/gix-pack/src/index/access.rs
index 0ac85dff7..c384109ac 100644
--- a/vendor/gix-pack/src/index/access.rs
+++ b/vendor/gix-pack/src/index/access.rs
@@ -13,7 +13,7 @@ const N32_HIGH_BIT: u32 = 1 << 31;
/// Represents an entry within a pack index file, effectively mapping object [`IDs`][gix_hash::ObjectId] to pack data file locations.
#[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 Entry {
/// The ID of the object
pub oid: gix_hash::ObjectId,
diff --git a/vendor/gix-pack/src/index/mod.rs b/vendor/gix-pack/src/index/mod.rs
index 341322f7d..36be2d429 100644
--- a/vendor/gix-pack/src/index/mod.rs
+++ b/vendor/gix-pack/src/index/mod.rs
@@ -76,20 +76,15 @@ macro_rules! izip {
use memmap2::Mmap;
/// The version of an index file
-#[derive(PartialEq, Eq, Ord, PartialOrd, Debug, Hash, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Default, PartialEq, Eq, Ord, PartialOrd, Debug, Hash, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(missing_docs)]
pub enum Version {
V1 = 1,
+ #[default]
V2 = 2,
}
-impl Default for Version {
- fn default() -> Self {
- Version::V2
- }
-}
-
impl Version {
/// The kind of hash to produce to be compatible to this kind of index
pub fn hash(&self) -> gix_hash::Kind {
diff --git a/vendor/gix-pack/src/index/traverse/mod.rs b/vendor/gix-pack/src/index/traverse/mod.rs
index 42c820b0e..68a502bca 100644
--- a/vendor/gix-pack/src/index/traverse/mod.rs
+++ b/vendor/gix-pack/src/index/traverse/mod.rs
@@ -216,11 +216,7 @@ where
E: std::error::Error + Send + Sync + 'static,
{
if check.object_checksum() {
- let mut hasher = gix_features::hash::hasher(index_entry.oid.kind());
- hasher.update(&gix_object::encode::loose_header(object_kind, decompressed.len()));
- hasher.update(decompressed);
-
- let actual_oid = gix_hash::ObjectId::from(hasher.digest());
+ let actual_oid = gix_object::compute_hash(index_entry.oid.kind(), object_kind, decompressed);
if actual_oid != index_entry.oid {
return Err(Error::PackObjectMismatch {
actual: actual_oid,
diff --git a/vendor/gix-pack/src/index/traverse/types.rs b/vendor/gix-pack/src/index/traverse/types.rs
index 84ebc8932..9fc21c0dc 100644
--- a/vendor/gix-pack/src/index/traverse/types.rs
+++ b/vendor/gix-pack/src/index/traverse/types.rs
@@ -2,7 +2,7 @@ use std::{collections::BTreeMap, marker::PhantomData};
/// Statistics regarding object encountered during execution of the [`traverse()`][crate::index::File::traverse()] method.
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Statistics {
/// The average over all decoded objects
pub average: crate::data::decode::entry::Outcome,
@@ -47,8 +47,8 @@ impl Default for Statistics {
}
/// The ways to validate decoded objects before passing them to the processor.
-#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Default, Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum SafetyCheck {
/// Don't verify the validity of the checksums stored in the index and pack file
SkipFileChecksumVerification,
@@ -63,6 +63,7 @@ pub enum SafetyCheck {
/// Perform all available safety checks before operating on the pack and
/// abort if any of them fails
+ #[default]
All,
}
@@ -83,19 +84,14 @@ impl SafetyCheck {
}
}
-impl Default for SafetyCheck {
- fn default() -> Self {
- SafetyCheck::All
- }
-}
-
/// The way we verify the pack
-#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Default, Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Algorithm {
/// Build an index to allow decoding each delta and base exactly once, saving a lot of computational
/// resource at the expense of resident memory, as we will use an additional `DeltaTree` to accelerate
/// delta chain resolution.
+ #[default]
DeltaTreeLookup,
/// We lookup each object similarly to what would happen during normal repository use.
/// Uses more compute resources as it will resolve delta chains from back to front, but start right away
@@ -105,12 +101,6 @@ pub enum Algorithm {
Lookup,
}
-impl Default for Algorithm {
- fn default() -> Self {
- Algorithm::DeltaTreeLookup
- }
-}
-
/// The progress ids used in [`traverse()`][crate::index::File::traverse()] .
///
/// Use this information to selectively extract the progress of interest in case the parent application has custom visualization.
diff --git a/vendor/gix-pack/src/index/verify.rs b/vendor/gix-pack/src/index/verify.rs
index 4a4852fb6..182f816ba 100644
--- a/vendor/gix-pack/src/index/verify.rs
+++ b/vendor/gix-pack/src/index/verify.rs
@@ -94,7 +94,7 @@ pub mod checksum {
}
/// Various ways in which a pack and index can be verified
-#[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)]
+#[derive(Default, Debug, Eq, PartialEq, Hash, Clone, Copy)]
pub enum Mode {
/// Validate the object hash and CRC32
HashCrc32,
@@ -103,15 +103,10 @@ pub enum Mode {
HashCrc32Decode,
/// Validate hash and CRC32, and decode and encode each non-Blob object.
/// Each object should yield exactly the same hash when re-encoded.
+ #[default]
HashCrc32DecodeEncode,
}
-impl Default for Mode {
- fn default() -> Self {
- Mode::HashCrc32DecodeEncode
- }
-}
-
/// Information to allow verifying the integrity of an index with the help of its corresponding pack.
pub struct PackContext<'a, F> {
/// The pack data file itself.
diff --git a/vendor/gix-pack/src/index/write/mod.rs b/vendor/gix-pack/src/index/write/mod.rs
index c8fdaa271..39ed0f31e 100644
--- a/vendor/gix-pack/src/index/write/mod.rs
+++ b/vendor/gix-pack/src/index/write/mod.rs
@@ -15,7 +15,7 @@ pub(crate) struct TreeEntry {
/// Information gathered while executing [`write_data_iter_to_stream()`][crate::index::File::write_data_iter_to_stream]
#[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 Outcome {
/// The version of the verified index
pub index_version: crate::index::Version,
diff --git a/vendor/gix-pack/src/multi_index/access.rs b/vendor/gix-pack/src/multi_index/access.rs
index d209cd0b9..488f996d3 100644
--- a/vendor/gix-pack/src/multi_index/access.rs
+++ b/vendor/gix-pack/src/multi_index/access.rs
@@ -12,7 +12,7 @@ use crate::{
/// Represents an entry within a multi index file, effectively mapping object [`IDs`][gix_hash::ObjectId] to pack data
/// files and the offset within.
#[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 Entry {
/// The ID of the object.
pub oid: gix_hash::ObjectId,
diff --git a/vendor/gix-pack/src/multi_index/mod.rs b/vendor/gix-pack/src/multi_index/mod.rs
index 3f7ed0ff5..d88ae0bae 100644
--- a/vendor/gix-pack/src/multi_index/mod.rs
+++ b/vendor/gix-pack/src/multi_index/mod.rs
@@ -3,19 +3,14 @@ use std::path::PathBuf;
use memmap2::Mmap;
/// Known multi-index file versions
-#[derive(PartialEq, Eq, Ord, PartialOrd, Debug, Hash, Clone, Copy)]
-#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
+#[derive(Default, PartialEq, Eq, Ord, PartialOrd, Debug, Hash, Clone, Copy)]
+#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[allow(missing_docs)]
pub enum Version {
+ #[default]
V1 = 1,
}
-impl Default for Version {
- fn default() -> Self {
- Version::V1
- }
-}
-
/// An index into our [`File::index_names()`] array yielding the name of the index and by implication, its pack file.
pub type PackIndex = u32;