Skip to content

Commit d2bea27

Browse files
committed
even nicer printing (#279)
1 parent e3dfa12 commit d2bea27

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

git-pack/src/multi_index/verify.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,25 @@ impl File {
8181
.map_err(crate::index::traverse::Error::Processor)?;
8282

8383
let mut pack_traverse_outcomes = Vec::new();
84+
85+
progress.set_name("Validating");
86+
let start = std::time::Instant::now();
87+
88+
progress.init(
89+
Some(self.num_indices as usize),
90+
git_features::progress::count("indices"),
91+
);
8492
for index_file_name in &self.index_names {
93+
progress.inc();
8594
let bundle = crate::Bundle::at(parent.join(index_file_name), self.object_hash)
8695
.map_err(integrity::Error::from)
8796
.map_err(crate::index::traverse::Error::Processor)?;
8897

89-
progress.set_name(index_file_name.display().to_string());
98+
let progress = progress.add_child(index_file_name.display().to_string());
9099
let crate::bundle::verify::integrity::Outcome {
91100
actual_index_checksum: _,
92101
pack_traverse_outcome,
93-
progress: used_progress,
102+
progress: _,
94103
} = bundle
95104
.verify_integrity(
96105
verify_mode,
@@ -135,9 +144,10 @@ impl File {
135144
}
136145
})?;
137146
pack_traverse_outcomes.push(pack_traverse_outcome);
138-
progress = used_progress;
139147
}
140148

149+
progress.show_throughput(start);
150+
141151
Ok(integrity::Outcome {
142152
actual_index_checksum,
143153
pack_traverse_outcomes,

gitoxide-core/src/pack/verify.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use git_repository::{
1010
Progress,
1111
};
1212
pub use index::verify::Mode;
13+
pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=3;
1314

1415
use crate::OutputFormat;
1516

src/plumbing/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub fn main() -> Result<()> {
283283
verbose,
284284
progress,
285285
progress_keep_open,
286-
None,
286+
verify::PROGRESS_RANGE,
287287
move |progress, out, err| {
288288
let mode = match (decode, re_encode) {
289289
(true, false) => verify::Mode::HashCrc32Decode,

0 commit comments

Comments
 (0)