1
+ use std:: time:: Instant ;
1
2
use std:: {
2
3
ops:: Deref ,
3
4
sync:: atomic:: { AtomicBool , Ordering } ,
@@ -120,8 +121,17 @@ impl super::Store {
120
121
}
121
122
let files = slot. files . load ( ) ;
122
123
let files = Option :: as_ref ( & files) . ok_or ( integrity:: Error :: NeedsRetryDueToChangeOnDisk ) ?;
124
+ let progress_message = |path : & std:: path:: Path | {
125
+ format ! (
126
+ "Checking integrity: {}" ,
127
+ path. file_name( )
128
+ . map( |f| f. to_string_lossy( ) )
129
+ . unwrap_or_else( std:: borrow:: Cow :: default )
130
+ )
131
+ } ;
123
132
124
- match files {
133
+ let start = Instant :: now ( ) ;
134
+ let ( mut child_progress, num_objects) = match files {
125
135
IndexAndPacks :: Index ( bundle) => {
126
136
let index;
127
137
let index = match bundle. index . loaded ( ) {
@@ -144,7 +154,7 @@ impl super::Store {
144
154
data,
145
155
options : options. clone ( ) ,
146
156
} ) ,
147
- progress. add_child ( "Checking integrity" ) ,
157
+ progress. add_child ( progress_message ( index . path ( ) ) ) ,
148
158
should_interrupt,
149
159
) ?;
150
160
statistics. push ( IndexStatistics {
@@ -155,6 +165,7 @@ impl super::Store {
155
165
. expect ( "pack provided so there are stats" ) ,
156
166
) ,
157
167
} ) ;
168
+ ( outcome. progress , index. num_objects ( ) )
158
169
}
159
170
IndexAndPacks :: MultiIndex ( bundle) => {
160
171
let index;
@@ -166,7 +177,7 @@ impl super::Store {
166
177
}
167
178
} ;
168
179
let outcome = index. verify_integrity (
169
- progress. add_child ( "Checking integrity" ) ,
180
+ progress. add_child ( progress_message ( index . path ( ) ) ) ,
170
181
should_interrupt,
171
182
options. clone ( ) ,
172
183
) ?;
@@ -183,8 +194,15 @@ impl super::Store {
183
194
. collect ( ) ,
184
195
) ,
185
196
} ) ;
197
+ ( outcome. progress , index. num_objects ( ) )
186
198
}
187
- }
199
+ } ;
200
+
201
+ child_progress. show_throughput_with (
202
+ start,
203
+ num_objects as usize ,
204
+ git_features:: progress:: count ( "objects" ) . expect ( "set" ) ,
205
+ ) ;
188
206
progress. inc ( ) ;
189
207
}
190
208
0 commit comments