@@ -14,6 +14,7 @@ use crate::{
14
14
15
15
///
16
16
pub mod integrity {
17
+ use std:: marker:: PhantomData ;
17
18
use std:: path:: PathBuf ;
18
19
19
20
use crate :: pack;
@@ -81,6 +82,29 @@ pub mod integrity {
81
82
/// The provided progress instance.
82
83
pub progress : P ,
83
84
}
85
+
86
+ /// The progress ids used in [`Store::verify_integrity()`][crate::Store::verify_integrity()].
87
+ ///
88
+ /// Use this information to selectively extract the progress of interest in case the parent application has custom visualization.
89
+ #[ derive( Debug , Copy , Clone ) ]
90
+ pub enum ProgressId {
91
+ /// Contains the path of the currently validated loose object database.
92
+ VerifyLooseObjectDbPath ,
93
+ /// The root progress for all verification of an index. It doesn't contain any useful information itself.
94
+ VerifyIndex ( PhantomData < git_pack:: index:: verify:: integrity:: ProgressId > ) ,
95
+ /// The root progress for all verification of a multi-index. It doesn't contain any useful information itself.
96
+ VerifyMultiIndex ( PhantomData < git_pack:: multi_index:: verify:: integrity:: ProgressId > ) ,
97
+ }
98
+
99
+ impl From < ProgressId > for git_features:: progress:: Id {
100
+ fn from ( v : ProgressId ) -> Self {
101
+ match v {
102
+ ProgressId :: VerifyLooseObjectDbPath => * b"VISP" ,
103
+ ProgressId :: VerifyMultiIndex ( _) => * b"VIMI" ,
104
+ ProgressId :: VerifyIndex ( _) => * b"VISI" ,
105
+ }
106
+ }
107
+ }
84
108
}
85
109
86
110
impl super :: Store {
@@ -154,7 +178,10 @@ impl super::Store {
154
178
data,
155
179
options : options. clone ( ) ,
156
180
} ) ,
157
- progress. add_child_with_id ( "never shown" , git_features:: progress:: UNKNOWN ) ,
181
+ progress. add_child_with_id (
182
+ "verify index" ,
183
+ integrity:: ProgressId :: VerifyIndex ( Default :: default ( ) ) . into ( ) ,
184
+ ) ,
158
185
should_interrupt,
159
186
) ?;
160
187
statistics. push ( IndexStatistics {
@@ -177,7 +204,10 @@ impl super::Store {
177
204
}
178
205
} ;
179
206
let outcome = index. verify_integrity (
180
- progress. add_child_with_id ( "never shown" , git_features:: progress:: UNKNOWN ) ,
207
+ progress. add_child_with_id (
208
+ "verify multi-index" ,
209
+ integrity:: ProgressId :: VerifyMultiIndex ( Default :: default ( ) ) . into ( ) ,
210
+ ) ,
181
211
should_interrupt,
182
212
options. clone ( ) ,
183
213
) ?;
@@ -216,7 +246,10 @@ impl super::Store {
216
246
for loose_db in & * index. loose_dbs {
217
247
let out = loose_db
218
248
. verify_integrity (
219
- progress. add_child_with_id ( loose_db. path ( ) . display ( ) . to_string ( ) , * b"VISP" ) , /* Verify Integrity Store Path */
249
+ progress. add_child_with_id (
250
+ loose_db. path ( ) . display ( ) . to_string ( ) ,
251
+ integrity:: ProgressId :: VerifyLooseObjectDbPath . into ( ) ,
252
+ ) ,
220
253
should_interrupt,
221
254
)
222
255
. map ( |statistics| integrity:: LooseObjectStatistics {
0 commit comments