@@ -14,6 +14,7 @@ use crate::{
1414
1515///
1616pub mod integrity {
17+ use std:: marker:: PhantomData ;
1718 use std:: path:: PathBuf ;
1819
1920 use crate :: pack;
@@ -81,6 +82,29 @@ pub mod integrity {
8182 /// The provided progress instance.
8283 pub progress : P ,
8384 }
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+ }
84108}
85109
86110impl super :: Store {
@@ -154,7 +178,10 @@ impl super::Store {
154178 data,
155179 options : options. clone ( ) ,
156180 } ) ,
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+ ) ,
158185 should_interrupt,
159186 ) ?;
160187 statistics. push ( IndexStatistics {
@@ -177,7 +204,10 @@ impl super::Store {
177204 }
178205 } ;
179206 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+ ) ,
181211 should_interrupt,
182212 options. clone ( ) ,
183213 ) ?;
@@ -216,7 +246,10 @@ impl super::Store {
216246 for loose_db in & * index. loose_dbs {
217247 let out = loose_db
218248 . 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+ ) ,
220253 should_interrupt,
221254 )
222255 . map ( |statistics| integrity:: LooseObjectStatistics {
0 commit comments