Skip to content

Commit

Permalink
Fix progress bar for long copies (#243)
Browse files Browse the repository at this point in the history
Fixes #227

The progress bar still resets when we copy multiple trees one after the
other, but that's less bad.
  • Loading branch information
sourcefrog authored Jan 14, 2024
2 parents 703295d + 6ef2265 commit 597b242
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ impl CopyModel {
/// Update that some bytes have been copied.
///
/// `bytes_copied` is the total bytes copied so far.
#[allow(dead_code)]
fn bytes_copied(&mut self, bytes_copied: u64) {
self.bytes_copied = bytes_copied
}
Expand Down
2 changes: 1 addition & 1 deletion src/copy_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn copy_tree(
})?;
total_bytes += bytes_copied;
total_files += 1;
console.copy_progress(bytes_copied);
console.copy_progress(total_bytes);
} else if ft.is_dir() {
std::fs::create_dir_all(&dest_path)
.with_context(|| format!("Failed to create directory {dest_path:?}"))?;
Expand Down

0 comments on commit 597b242

Please sign in to comment.