1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
use std::collections::BTreeMap;
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub struct Outcome {
pub average: crate::data::decode_entry::Outcome,
pub objects_per_chain_length: BTreeMap<u32, u32>,
pub total_compressed_entries_size: u64,
pub total_decompressed_entries_size: u64,
pub total_object_size: u64,
pub pack_size: u64,
pub num_commits: u32,
pub num_trees: u32,
pub num_tags: u32,
pub num_blobs: u32,
}
impl Default for Outcome {
fn default() -> Self {
Outcome {
average: crate::data::decode_entry::Outcome::default_from_kind(git_object::Kind::Tree),
objects_per_chain_length: Default::default(),
total_compressed_entries_size: 0,
total_decompressed_entries_size: 0,
total_object_size: 0,
pack_size: 0,
num_blobs: 0,
num_commits: 0,
num_trees: 0,
num_tags: 0,
}
}
}
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum SafetyCheck {
SkipFileChecksumVerification,
SkipFileAndObjectChecksumVerification,
SkipFileAndObjectChecksumVerificationAndNoAbortOnDecodeError,
All,
}
impl SafetyCheck {
pub(crate) fn file_checksum(&self) -> bool {
matches!(self, SafetyCheck::All)
}
pub(crate) fn object_checksum(&self) -> bool {
matches!(self, SafetyCheck::All | SafetyCheck::SkipFileChecksumVerification)
}
pub(crate) fn fatal_decode_error(&self) -> bool {
match self {
SafetyCheck::All
| SafetyCheck::SkipFileChecksumVerification
| SafetyCheck::SkipFileAndObjectChecksumVerification => true,
SafetyCheck::SkipFileAndObjectChecksumVerificationAndNoAbortOnDecodeError => false,
}
}
}
impl Default for SafetyCheck {
fn default() -> Self {
SafetyCheck::All
}
}
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone, Copy)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum Algorithm {
DeltaTreeLookup,
Lookup,
}
impl Default for Algorithm {
fn default() -> Self {
Algorithm::DeltaTreeLookup
}
}