Restic rewrite explanation

I have seen the new restic rewrite feature (Working with repositories — restic 0.15.2 documentation), however, documentation IMHO is a little bit lacking.

I have the following experience:

$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --path .local/ --dry
unknown flag: --dry                                                                                                                                                                                        
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --path .local/ --dry-run
repository a72e6e8d opened (version 1)                                                                                                                                                                     
                                                                                                                                                                                                           
no snapshots would be modified                                                                                                                                                                             
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --path h/s/.local/ --dry-run
repository a72e6e8d opened (version 1)                                                                                                                                                                     
                                                                                                                                                                                                           
no snapshots would be modified                                                                                                                                                                             
$ /usr/bin/restic -r repo rewrite --exclude "h/s/.local/share/pnpm/store/" --exclude "h/s/.local/share/virtualenv/" --path h/s/.local/ --dry-run
repository a72e6e8d opened (version 1)                                                                                                                                                                     
                                                                                                                                                                                                           
no snapshots would be modified                                                                                                                                                                             
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --dry-run
repository a72e6e8d opened (version 1)

snapshot 004a1036 of [/h/s] at 2022-09-19 16:29:30.018029696 +0300 EEST)
excluding /h/s/.local/share/virtualenv
would save new snapshot

snapshot 00e1f3ca of [/h/s] at 2023-03-12 23:34:36.859780094 +0200 EET)
excluding /h/s/.local/share/pnpm/store
excluding /h/s/.local/share/virtualenv
would save new snapshot

snapshot 00168f5b of [/h/s] at 2022-10-06 11:52:50.918561813 +0300 EEST)
excluding /h/s/.local/share/virtualenv
  signal interrupt received, cleaning up
$ /usr/bin/restic -r repo rewrite --exclude ".local/share/pnpm/store/" --exclude ".local/share/virtualenv/" --exclude ".ssh/perf-16*" --exclude "Documents/a/b/c/d"
repository a72e6e8d opened (version 1)

snapshot 00168f5b of [/h/s] at 2022-10-06 11:52:50.918561813 +0300 EEST)
excluding /h/s/.local/share/virtualenv
excluding /h/s/Documents/a/b/c/d
saved new snapshot bdcd18ba

snapshot 004a1036 of [/h/s] at 2022-09-19 16:29:30.018029696 +0300 EEST)
excluding /h/s/.local/share/virtualenv
excluding /h/s/Documents/a/b/c/d
saved new snapshot 2d8f1501

As you can see, I needed to let go of the --path to have it working :confused:
I may be over-optimizing, but I have a “big enough repo” I thought it was warranted.

The --path parameter refers to the path list of a snapshot, which is /h/s in your case. That is --path /h/s would work.

Oh - so that is for the option to have multiple “top-level paths” on the same repo. Snapshots are not somehow easily filtered by path affected, inside the same --path.

Got it, thanks