mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 12:55:18 +00:00
Merge pull request #4409 from arjunajesh/issue#1495
snapshots sorted by timestamp in restic find
This commit is contained in:
commit
1fe1ec40a2
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