Skip to content

Commit

Permalink
avoid showing thread progress during clone-pack-resolution (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Oct 17, 2022
1 parent 6f8356c commit 056f4dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion git-repository/src/clone/checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::Repository;
///
pub mod main_worktree {
use crate::clone::PrepareCheckout;
use crate::Repository;
use crate::{Progress, Repository};
use git_odb::FindExt;
use std::path::PathBuf;
use std::sync::atomic::AtomicBool;
Expand Down Expand Up @@ -71,6 +71,10 @@ pub mod main_worktree {
let mut files = progress.add_child("checkout");
let mut bytes = progress.add_child("writing");

files.init(Some(index.entries().len()), crate::progress::count("files"));
bytes.init(None, crate::progress::bytes());

let start = std::time::Instant::now();
git_worktree::index::checkout(
&mut index,
workdir,
Expand All @@ -83,6 +87,8 @@ pub mod main_worktree {
should_interrupt,
opts,
)?;
files.show_throughput(start);
bytes.show_throughput(start);

index.write(Default::default())?;
Ok(self.repo.take().expect("still present"))
Expand Down
2 changes: 1 addition & 1 deletion gitoxide-core/src/repository/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct Options {
pub handshake_info: bool,
}

pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=4;
pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=3;

pub(crate) mod function {
use anyhow::bail;
Expand Down

0 comments on commit 056f4dd

Please sign in to comment.