update ignore logic to allow paths to start with /, end with /, and include / in the middle

This commit is contained in:
Josh Holtrop 2018-03-06 23:19:42 -05:00
parent 96010f2590
commit 68cd8c27cc

View File

@ -5,6 +5,12 @@ module Svi
def is_path_ignored?(path, config)
config.ignores.find do |ignore_pattern|
ignore_pattern.chomp!("/")
if ignore_pattern.start_with?("/")
ignore_pattern = ignore_pattern[1, ignore_pattern.size]
elsif not ignore_pattern["/"]
path = File.basename(path)
end
File.fnmatch(ignore_pattern, path, File::FNM_PATHNAME)
end
end