Hej it’s me again! (Thanks for the help last time. I’m getting there)
I’m almost sure this is a feature, but I tried figuring it out with the documentation and the --help, (and didn’t figure out how to do it)
Is there a way to learn which files were added (and/or removed, ideally excluding modified) in the latest snapshot compared to its parent, using a single command? (Ideally with output that looks like the tree-command, but I don’t mind if it doesn’t)
I can get the info I’m looking for with restic snapshots, manually copying the IDs, using restic diff with them, (and massaging the output with grep, dirname etc could get me the rest of the way to something e.g. tree --fromfile can digest), but is there something like restic diff latest --parent-of=latest ?
Please use the json output of a command if available and don’t parse the text output format, which is not guaranteed to be stable, in that case.
That is I would change the snapshot selection as follows: restic diff $(restic snapshots --json latest | jq -r ".[0].id, .[0].parent") | awk '($1=="+")' | cut -f 2- -d ' ' | tree --fromfile .
This may be slightly off topic, but I was just playing around with this command and noticed that in many of my snapshots the parent attribute pointed to a non-existent snapshot.
I had coincidentally just updated a bunch of tags right before that, so I assume that is the underlying reason, but I was curious: is it a known issue that when you change tags on a snapshot, any parents referencing that snapshot get orphaned?
Yes, a snapshot’s ID will, by design, change if you change its tags. This is a consequence of restic’s repository format, as described here.
If you need the original ID of a snapshot for some reason, this is still accessible with the command restic cat snapshot, where it will be listed under the field original.