restic/internal/data
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
..
testdata data: fix invalid trees used in test cases 2026-01-31 19:18:36 +01:00
duration.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
duration_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
find.go data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
find_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
node.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
node_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
node_windows.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_find.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_find_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_group.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_group_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_policy.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_policy_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
snapshot_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
tag_list.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
tag_list_test.go data: split node and snapshot code from restic package 2025-10-03 19:10:39 +02:00
testing.go data: move TestTreeMap to data package to allow reuse 2026-01-31 20:03:38 +01:00
testing_test.go repository: add dedicated test helper 2025-10-03 19:34:33 +02:00
tree.go restic rewrite include - based on restic 0.18.1 2026-01-31 19:42:56 +00:00
tree_stream.go data: replace Tree with TreeNodeIterator 2026-01-31 20:03:38 +01:00
tree_test.go data: add support for unknown keys to treeIterator 2026-01-31 20:03:38 +01:00