2
2
mirror of https://github.com/octoleo/restic.git synced 2024-09-27 14:09:01 +00:00
restic/internal
Vincent Bernat 2ee07ded2b filter: ability to use negative patterns
This is quite similar to gitignore. If a pattern is suffixed by an
exclamation mark and match a file that was previously matched by a
regular pattern, the match is cancelled. Notably, this can be used
with `--exclude-file` to cancel the exclusion of some files.

Like for gitignore, once a directory is excluded, it is not possible
to include files inside the directory. For example, a user wanting to
only keep `*.c` in some directory should not use:

    ~/work
    !~/work/*.c

But:

    ~/work/*
    !~/work/*.c

I didn't write documentation or changelog entry. I would like to get
feedback if this is the right approach for excluding/including files
at will for backups. I use something like this as an exclude file to
backup my home:

    $HOME/**/*
    !$HOME/Documents
    !$HOME/code
    !$HOME/.emacs.d
    !$HOME/games
    # [...]
    node_modules
    *~
    *.o
    *.lo
    *.pyc
    # [...]
    $HOME/code/linux/*
    !$HOME/code/linux/.git
    # [...]

There are some limitations for this change:

 - Patterns are not mixed accross methods: patterns from file are
   handled first and if a file is excluded with this method, it's not
   possible to reinclude it with `--exclude !something`.

 - Patterns starting with `!` are now interpreted as a negative
   pattern. I don't think anyone was relying on that.

 - The whole list of patterns is walked for each match. We may
   optimize later by exiting early if we know no pattern is starting
   with `!`.

Fix #233
2022-03-20 13:33:08 +01:00
..
archiver Merge pull request #3510 from MichaelEischer/fix-archiver-early-on-abort 2021-10-16 15:37:41 +02:00
backend Merge pull request #3544 from restic/fix-b2-delete-retry 2022-01-13 23:28:30 +01:00
bloblru Check cap instead of len in bloblru 2021-10-03 09:34:17 +02:00
cache Merge pull request #3474 from kitone/fix-issue-3382 2021-11-07 17:57:54 +01:00
checker Add plumbing to calculate backend specific file hash for upload 2021-08-04 22:17:46 +02:00
crypto crypto: Remove unused error 2020-09-05 10:07:16 +02:00
debug Allow debug logging to pipes and terminals 2020-10-19 22:30:30 +02:00
dump Refactor internal/dump + concurrent load/write 2021-11-01 23:01:55 +01:00
errors Modernize error handling in local backend 2021-06-18 11:13:27 +02:00
filter filter: ability to use negative patterns 2022-03-20 13:33:08 +01:00
fs backup: Set O_NOATIME in the right place 2022-02-06 15:00:37 +01:00
fuse Move Blobcache into dedicated internal package 2021-09-24 15:45:00 +02:00
hashing errcheck: Add error checks 2021-01-30 20:02:37 +01:00
limiter Add plumbing to calculate backend specific file hash for upload 2021-08-04 22:17:46 +02:00
migrations Fix issues reported by semgrep 2020-12-11 09:41:59 +01:00
mock Add plumbing to calculate backend specific file hash for upload 2021-08-04 22:17:46 +02:00
options Some options fixes 2020-12-23 23:26:04 +03:00
pack Add plumbing to calculate backend specific file hash for upload 2021-08-04 22:17:46 +02:00
repository Replace siphash by hash/maphash 2021-09-19 16:05:18 +02:00
restic [#issue 3127] Add xattr support for Solaris 2022-02-13 14:24:37 +05:30
restorer restore: Fix linting error 2021-09-19 14:41:07 +02:00
selfupdate self-update: Don't cancel download after 30 seconds 2019-02-23 11:15:18 +01:00
test Add more error handling 2021-01-30 20:19:47 +01:00
textfile Add more error handling 2021-01-30 20:19:47 +01:00
ui ui: consolidate backup ui in ui/backup package 2021-09-12 16:20:15 +02:00
walker internal/restic: Don't allocate in Tree.Insert 2021-09-26 18:08:48 +02:00