ETOOBUSY 🚀 minimal blogging for the impatient
Where I tell you about the pull request to distinguish between two different false values in Text::Gitignore.
Previous post Unmatched is not Excluded contains a few suggestions for
extending Text::Gitignore so that false values returned by the
matcher functions (as generated by
build_gitignore_matcher) also convey
the additional information that:
the input path failed to match every non-negated pattern, i.e. it is ignored by the current rules. In this case,
undefis returned, to signify that nothing was hit for this item, OR
the input path was excluded because of a negated pattern. In this case, a false but defined value is returned.
The following examples should help better framing the explanation above:
my $matcher = build_gitignore_matcher(['f*', '!foo*', 'foobar']); my $matched = $matcher->('foobar'); # $matched set to true my $ignored = $matcher->('bar'); # $ignored set to undef my $excluded = $matcher->('foolish'); # $excluded set to false but defined (e.g. 0)
This ended up in the Pull Request… fingers crossed!