Skip to content

Commit

Permalink
even nicer printing (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 29, 2021
1 parent e3dfa12 commit d2bea27
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
16 changes: 13 additions & 3 deletions git-pack/src/multi_index/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,25 @@ impl File {
.map_err(crate::index::traverse::Error::Processor)?;

let mut pack_traverse_outcomes = Vec::new();

progress.set_name("Validating");
let start = std::time::Instant::now();

progress.init(
Some(self.num_indices as usize),
git_features::progress::count("indices"),
);
for index_file_name in &self.index_names {
progress.inc();
let bundle = crate::Bundle::at(parent.join(index_file_name), self.object_hash)
.map_err(integrity::Error::from)
.map_err(crate::index::traverse::Error::Processor)?;

progress.set_name(index_file_name.display().to_string());
let progress = progress.add_child(index_file_name.display().to_string());
let crate::bundle::verify::integrity::Outcome {
actual_index_checksum: _,
pack_traverse_outcome,
progress: used_progress,
progress: _,
} = bundle
.verify_integrity(
verify_mode,
Expand Down Expand Up @@ -135,9 +144,10 @@ impl File {
}
})?;
pack_traverse_outcomes.push(pack_traverse_outcome);
progress = used_progress;
}

progress.show_throughput(start);

Ok(integrity::Outcome {
actual_index_checksum,
pack_traverse_outcomes,
Expand Down
1 change: 1 addition & 0 deletions gitoxide-core/src/pack/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use git_repository::{
Progress,
};
pub use index::verify::Mode;
pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=3;

use crate::OutputFormat;

Expand Down
2 changes: 1 addition & 1 deletion src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ pub fn main() -> Result<()> {
verbose,
progress,
progress_keep_open,
None,
verify::PROGRESS_RANGE,
move |progress, out, err| {
let mode = match (decode, re_encode) {
(true, false) => verify::Mode::HashCrc32Decode,
Expand Down

0 comments on commit d2bea27

Please sign in to comment.