File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,9 +302,6 @@ impl SnapshotManager {
302302 None => anyhow:: bail!( "Tag '{}' does not exist" , tag) ,
303303 }
304304 }
305- // Deduplicate: multiple tags may point to same snapshot
306- ids. sort ( ) ;
307- ids. dedup ( ) ;
308305 ids
309306 } else {
310307 // No filter: load all snapshots
@@ -329,8 +326,14 @@ impl SnapshotManager {
329326 snapshots. push ( snapshot. into ( ) ) ;
330327 }
331328
332- // Sort by creation time (newest first)
333- snapshots. sort_by ( |a : & SnapshotInfo , b : & SnapshotInfo | b. created_at . cmp ( & a. created_at ) ) ;
329+ // Sort by creation time (newest first), then deduplicate by ID
330+ // Note: when filtering by tags, multiple tags may point to same snapshot
331+ snapshots. sort_by ( |a : & SnapshotInfo , b : & SnapshotInfo | {
332+ b. created_at . cmp ( & a. created_at ) . then_with ( || a. id . cmp ( & b. id ) )
333+ } ) ;
334+
335+ // Deduplicate by ID (keep first occurrence = newest due to sort)
336+ snapshots. dedup_by ( |a, b| a. id == b. id ) ;
334337
335338 Ok ( snapshots)
336339 }
You can’t perform that action at this time.
0 commit comments