Skip to content

Commit

Permalink
fix(commands): Properly finish progress bars
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed May 14, 2024
1 parent 0999375 commit f1f73db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/core/src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use crate::{
binarysorted::{IndexCollector, IndexType},
GlobalIndex, IndexEntry, ReadGlobalIndex, ReadIndex,
},
progress::{NoProgressBars, ProgressBars},
progress::{NoProgressBars, Progress, ProgressBars},
repofile::{
keyfile::find_key_in_backend,
snapshotfile::{SnapshotGroup, SnapshotGroupCriterion},
Expand Down Expand Up @@ -910,6 +910,7 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
) -> RusticResult<SnapshotFile> {
let p = self.pb.progress_counter("getting snapshot...");
let snap = SnapshotFile::from_str(self.dbe(), id, filter, &p)?;
p.finish();
Ok(snap)
}

Expand All @@ -929,7 +930,9 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
// TODO: Document errors
pub fn get_snapshots<T: AsRef<str>>(&self, ids: &[T]) -> RusticResult<Vec<SnapshotFile>> {
let p = self.pb.progress_counter("getting snapshots...");
SnapshotFile::from_ids(self.dbe(), ids, &p)
let result = SnapshotFile::from_ids(self.dbe(), ids, &p);
p.finish();
result
}

/// Get all snapshots from the repository
Expand Down Expand Up @@ -958,7 +961,9 @@ impl<P: ProgressBars, S: Open> Repository<P, S> {
filter: impl FnMut(&SnapshotFile) -> bool,
) -> RusticResult<Vec<SnapshotFile>> {
let p = self.pb.progress_counter("getting snapshots...");
SnapshotFile::all_from_backend(self.dbe(), filter, &p)
let result = SnapshotFile::all_from_backend(self.dbe(), filter, &p);
p.finish();
result
}

/// Get snapshots to forget depending on the given [`KeepOptions`]
Expand Down

0 comments on commit f1f73db

Please sign in to comment.