Currently, you can specify any of host,paths,tags to group your snapshots before a forget policy is applied. The default is “host,paths” and the intent is to group similar file/directory collections together when deciding what snapshots to forget.
But --exclude paths are not considered or available in the grouping algorithm. So you could have two snapshots that are from the same host and path, but contain completely different files.
restic backup /home --exclude /home/foo/*
restic backup /home --exclude /home/bar/*
And applying a policy to both of these snapshot sets together may have very unexpected results, possibly resulting in the completely loss of foo/* or bar/* depending on job ordering.
So, the feature idea: add an “excludes” key to the available --group-by keys. It could be a full text list of the excludes (similar to paths), or perhaps a hash to keep the snapshot metadata smaller.
This would fix the backup issue described above. The two backup invocations would be grouped separately and forget would keep snapshots from both.
A more general solution: migrate from --exclude args to exclude selection as part of the paths: “restic backup /home ex:/home/foo/*” for example). Then the excluded paths are considered part of the overall path spec, and this just works. And then you have a means to specify priority between includes and excludes, which I think has been discussed elsewhere.
I know this can be solved with tags, but it seems like a more intuitive solution is possible.