Problem
The <<
and include
methods behave inconsistently with exclusions:
exclude
then include
: exclusion wins (correct)
exclude
then <<
: file gets included anyway (bug)
Example
include_list = FileList.new
include_list.exclude 'abc.c'
include_list.include 'abc.c' # Correctly excluded: []
shovel_list = FileList.new
shovel_list.exclude 'abc.c'
shovel_list << 'abc.c' # Bug: returns ["abc.c"]
shovel_list.resolve # Still returns ["abc.c"] - resolve doesn't fix it
shovel_list.include 'xyz.rb' # Now returns ["xyz.rb"], "abc.c" is finally removed
Fix
Add resolve_exclude
to the <<
method:
def <<(obj)
resolve
@items << Rake.from_pathname(obj)
resolve_exclude # ADD THIS LINE
self
end
I have a PR with fix & tests ready to go if this approach looks good to maintainers