Skip to content

Commit 45e70c4

Browse files
committed
fix: get_snapshot_group result is organized by groups again
1 parent 8ee2526 commit 45e70c4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

crates/core/src/commands/snapshots.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! `snapshot` subcommand
22
3+
use itertools::Itertools;
4+
35
use crate::{
46
Progress,
57
error::RusticResult,
@@ -41,11 +43,15 @@ pub(crate) fn get_snapshot_group<P: ProgressBars, S: Open>(
4143
let groups = if ids.is_empty() {
4244
SnapshotFile::group_from_backend(dbe, filter, group_by, &p)?
4345
} else {
44-
let item = (
45-
SnapshotGroup::default(),
46-
SnapshotFile::from_strs(dbe, ids, filter, &p)?,
47-
);
48-
vec![item]
46+
let snaps = SnapshotFile::from_strs(dbe, ids, filter, &p)?;
47+
let mut result = Vec::new();
48+
for (group, snaps) in &snaps
49+
.into_iter()
50+
.chunk_by(|sn| SnapshotGroup::from_snapshot(sn, group_by))
51+
{
52+
result.push((group, snaps.collect()));
53+
}
54+
result
4955
};
5056
p.finish();
5157

0 commit comments

Comments
 (0)