Skip to content

Commit 77d993c

Browse files
committed
refactor: progress.tick support attaching message
1 parent a85ae1a commit 77d993c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ fn reset(repo: &git2::Repository, obj: &git2::Object<'_>, config: &Config) -> Ca
677677
let mut pb = Progress::new("Checkout", config);
678678
let mut opts = git2::build::CheckoutBuilder::new();
679679
opts.progress(|_, cur, max| {
680-
drop(pb.tick(cur, max));
680+
drop(pb.tick(cur, max, ""));
681681
});
682682
debug!("doing reset");
683683
repo.reset(obj, git2::ResetType::Hard, Some(&mut opts))?;
@@ -699,7 +699,7 @@ pub fn with_fetch_options(
699699

700700
rcb.transfer_progress(|stats| {
701701
progress
702-
.tick(stats.indexed_objects(), stats.total_objects())
702+
.tick(stats.indexed_objects(), stats.total_objects(), "")
703703
.is_ok()
704704
});
705705

src/cargo/util/progress.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'cfg> Progress<'cfg> {
9696
Self::with_style(name, ProgressStyle::Percentage, cfg)
9797
}
9898

99-
pub fn tick(&mut self, cur: usize, max: usize) -> CargoResult<()> {
99+
pub fn tick(&mut self, cur: usize, max: usize, msg: &str) -> CargoResult<()> {
100100
let s = match &mut self.state {
101101
Some(s) => s,
102102
None => return Ok(()),
@@ -118,7 +118,7 @@ impl<'cfg> Progress<'cfg> {
118118
return Ok(());
119119
}
120120

121-
s.tick(cur, max, "")
121+
s.tick(cur, max, msg)
122122
}
123123

124124
pub fn tick_now(&mut self, cur: usize, max: usize, msg: &str) -> CargoResult<()> {

0 commit comments

Comments
 (0)