Repository navigation
recreate: isolate tagged-dir exclusions per archive and place before include_patterns, fixes #10609 - #10611
Open
shikhabhadoria wants to merge 1 commit into
Open
recreate: isolate tagged-dir exclusions per archive and place before include_patterns, fixes #10609#10611shikhabhadoria wants to merge 1 commit into
shikhabhadoria wants to merge 1 commit into
Conversation
…include_patterns, fixes borgbackup#10609 Reset self.matcher._items at the start of each ArchiveRecreater.recreate() call so tagged-directory rules added by matcher_add_tagged_dirs() for one archive do not leak into subsequent archives in the same run. Also insert tag_files and tagged_dirs before matcher.include_patterns so positional PATH arguments do not match before ExcludeNoRecurse rules.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10611 +/- ##
=======================================
Coverage 89.39% 89.39%
=======================================
Files 105 105
Lines 20340 20346 +6
Branches 3194 3195 +1
=======================================
+ Hits 18182 18188 +6
Misses 1500 1500
Partials 658 658 ☔ View full report in Codecov by Harness. |
Author
|
This PR is ready for review whenever convenient. All CI checks and tests are passing. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #10609.
RecreateMixIn.do_recreate()passes a singlePatternMatcherinstance toArchiveRecreater, andArchiveRecreater.matcher_add_tagged_dirs()previously mutatedself.matcherin place by appendingtag_files(IECommand.Include) andtagged_dirs(IECommand.ExcludeNoRecurse) at the end ofself.matcher._items:tagged_dirsadded for an earlier archive remained inself.matcher._itemsfor subsequent archives, deleting those paths from later archives even when the tag file was no longer present there (and makingself.matcher.empty()false for all subsequent archives).ArchiveRecreater.recreate()now resetsself.matcher._itemsfromself.base_matcher_itemsat the start of each archive.PATHarguments were given on the command line,build_matcher()placedmatcher.include_patterns(IECommand.Include) inmatcher._itemsbeforematcher_add_tagged_dirs()appendedtagged_dirs(IECommand.ExcludeNoRecurse). BecausePatternMatcher.match()is first-match-wins, theIncluderule fromargs.pathsmatched first andtagged_dirswas never reached.matcher_add_tagged_dirs()now placestag_files(for tag items matchingmatcher) andtagged_dirsbeforematcher.include_patterns.Tests (
src/borg/testsuite/archiver/recreate_cmd_test.py):test_recreate_exclude_caches_multiple_archives_and_paths: verifies thatborg recreate --exclude-caches inputexcludes the tagged cache directory inarch1while preserving the untagged directory of the same path inarch2.Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)