Static defaultExclusions rules are not congruent #54
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.
The default rule set did not reflect the necessary "negationsAfter" state for rules that appear before the default negation rule.
This caused Pack to skip the entire
.terraform/modules
directory when it was encountered because it believed the previous rule about.terraform/
to be dominant.Any time a .terraformignore file containing a negation was evaluated, these default rules would be corrected by the parsing algorithm. This is why this bug was not caught by the tests. So I added another Pack test that relies only on the default rules.
In the second commit, moving the .git/ exclusion rule to the end of the default list, makes it possible to skip the entire .git/ directory walk because no exclusions appear after it. This should slightly speed up packing performance when the default rules are used or when no additional exclusion rules are set by .terraformignore.
The field
dirs
on each rule was not used so I removed it entirely.