2
2
mirror of https://github.com/octoleo/restic.git synced 2025-03-20 16:12:22 +00:00
Aneesh Agrawal 058dfc20da Avoid choosing parent snapshot newer than time of current snapshot
Currently, `restic backup` (if a `--parent` is not provided)
will choose the most recent matching snapshot as the parent snapshot.
This makes sense in the usual case,
where we tag the snapshot-being-created with the current time.

However, this doesn't make sense if the user has passed `--time`
and is currently creating a snapshot older than the latest snapshot.
Instead, choose the most recent snapshot
which is not newer than the snapshot-being-created's timestamp,
to avoid any time travel.

Impetus for this change:
I'm using restic for the first time!
I have a number of existing BTRFS snapshots
I am backing up via restic to serve as my initial set of backups.
I initially `restic backup`'d the most recent snapshot to test,
then started backing up each of the other snapshots.
I noticed in `restic cat snapshot <id>` output
that all the remaining snapshots have the most recent as the parent.
2022-01-23 23:55:00 -05:00
..
2021-08-04 21:19:29 +02:00
2021-09-07 21:18:11 +02:00
2021-09-12 16:00:49 +02:00
2021-11-04 15:13:48 +01:00
2021-12-27 18:22:25 +01:00
2021-11-13 22:25:54 +01:00
2021-09-19 14:41:07 +02:00
2021-09-03 21:36:57 +02:00
2021-08-16 17:42:16 +02:00
2021-08-04 21:51:53 +02:00
2021-08-22 18:29:58 +02:00
2021-09-24 15:45:09 +02:00
2021-09-19 16:18:19 +02:00