restic/internal
Winfried Plappert 5148608c39 restic rewrite include - based on restic 0.18.1
cmd/restic/cmd_rewrite.go:
introduction of include filters for this command:
- add include filters, add error checking code
- add new parameter 'keepEmptyDirectoryFunc' to 'walker.NewSnapshotSizeRewriter()',
  so empty directories have to be kept to keep the directory structure intact
- add parameter 'keepEmptySnapshot' to 'filterAndReplaceSnapshot()' to keep snapshots
  intact when nothing is to be included
- introduce helper function 'gatherIncludeFilters()' and 'gatherExcludeFilters()' to
  keep code flow clean

cmd/restic/cmd_rewrite_integration_test.go:
add several new tests around the 'include' functionality

internal/filter/include.go:
this is where is include filter is defined

internal/walker/rewriter.go:
- struct RewriteOpts gains field 'KeepEmtpyDirectory', which is a 'NodeKeepEmptyDirectoryFunc()'
  which defaults to nil, so that al subdirectories are kept
- function 'NewSnapshotSizeRewriter()' gains the parameter 'keepEmptyDirecoryFilter' which
  controls the management of empty subdirectories in case of include filters active

internal/data/tree.go:
gains a function Count() for checking the number if node elements in a newly built tree

internal/walker/rewriter_test.go:
function 'NewSnapshotSizeRewriter()' gets an additional parameter nil to keeps things happy

cmd/restic/cmd_repair_snapshots.go:
function 'filterAndReplaceSnapshot()' gets an additional parameter 'keepEmptySnapshot=nil'

doc/045_working_with_repos.rst:
gets to mention include filters

changelog/unreleased/issue-4278:
the usual announcement file

git rebase master -i produced this

restic rewrite include - keep linter happy

cmd/restic/cmd_rewrite_integration_test.go:
linter likes strings.Contain() better than my strings.Index() >= 0
2026-01-31 19:42:56 +00:00
..
archiver data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
backend test: use generics in Equal function signature 2026-01-31 20:03:38 +01:00
bloblru Fix typos 2024-07-03 20:02:06 +02:00
checker data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
crypto crypto: cleanup ciphertext verification error 2024-06-05 22:33:20 +02:00
data restic rewrite include - based on restic 0.18.1 2026-01-31 19:42:56 +00:00
debug remove old // +build comments 2025-11-30 11:53:23 +01:00
dump data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
errors tests: add tests for preserving underlying errors 2025-09-13 23:32:39 +05:30
feature readd feature flags removed too soon 2025-03-26 18:38:30 +01:00
filter restic rewrite include - based on restic 0.18.1 2026-01-31 19:42:56 +00:00
fs remove old // +build comments 2025-11-30 11:53:23 +01:00
fuse data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
global remove old // +build comments 2025-11-30 11:53:23 +01:00
migrations Fix godoc comments. 2025-03-22 18:20:30 +00:00
options backend, options: Prefer strings.Cut to SplitN 2022-12-02 19:19:14 +01:00
repository repository: prevent test deadlock within WithBlobUploader 2026-01-31 19:18:36 +01:00
restic remove old // +build comments 2025-11-30 11:53:23 +01:00
restorer data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
selfupdate remove old // +build comments 2025-11-30 11:53:23 +01:00
terminal remove old // +build comments 2025-11-30 11:53:23 +01:00
test test: use generics in Equal function signature 2026-01-31 20:03:38 +01:00
textfile Replace most usages of ioutil with the underlying function 2022-12-02 19:36:43 +01:00
ui test: use generics in Equal function signature 2026-01-31 20:03:38 +01:00
walker restic rewrite include - based on restic 0.18.1 2026-01-31 19:42:56 +00:00