Extending exclude-if-present

I apologize if this is not the place to ask or if it has been asked already (I tried to search but I don’t think it has)

The idea I had would be to extend the ‘exclude-if-present’ (or create a new command for backwards compatibility) with an include behaviour.

In my understanding of how the code works before starting the backup it first creates a list of files by using a series of filter actions and recursing over the file tree.

The exclude-if-present check specifically seems to check if a folder contains the given filename (with possibly the given tag) and if it does it doesn’t add anything to the queue of nodes (except the file itself) to “explore” while if it doesn’t it adds the contents of the folder

My idea would be to allow users to specify inside the special file itself a possible list of relative paths (to avoid issues it could be restricted to exclude absolute paths or paths including ‘…’) with the same semantics of the files specified with ‘–include-from’

This would allow to easily specify a subset of files to be backed up inside a folder whose contents I would otherwise like to ignore

It would also be easier to manage for the user than keeping a centralized list of includes to pass to restic and would allow to immediately know what will be included in the backup