mirror of
https://github.com/octoleo/restic.git
synced 2024-12-26 04:17:29 +00:00
snapshots sorted by timestamp
This commit is contained in:
parent
98fb56baa6
commit
32f5ee6f4e
7
changelog/unreleased/issue-1495
Normal file
7
changelog/unreleased/issue-1495
Normal file
@ -0,0 +1,7 @@
|
||||
Enhancement: Snapshots are sorted by timestamp in the output of `restic find`
|
||||
|
||||
The `find` command printed snapshots in an arbitrary order. Now restic prints
|
||||
the snapshots sorted by timestamp.
|
||||
|
||||
https://github.com/restic/restic/issues/1495
|
||||
https://github.com/restic/restic/pull/4409
|
@ -621,7 +621,16 @@ func runFind(ctx context.Context, opts FindOptions, gopts GlobalOptions, args []
|
||||
}
|
||||
}
|
||||
|
||||
var filteredSnapshots []*restic.Snapshot
|
||||
for sn := range FindFilteredSnapshots(ctx, snapshotLister, repo, &opts.SnapshotFilter, opts.Snapshots) {
|
||||
filteredSnapshots = append(filteredSnapshots, sn)
|
||||
}
|
||||
|
||||
sort.Slice(filteredSnapshots, func(i, j int) bool {
|
||||
return filteredSnapshots[i].Time.Before(filteredSnapshots[j].Time)
|
||||
})
|
||||
|
||||
for _, sn := range filteredSnapshots {
|
||||
if f.blobIDs != nil || f.treeIDs != nil {
|
||||
if err = f.findIDs(ctx, sn); err != nil && err.Error() != "OK" {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user