From 68cd8c27cc8803178ef2ebcf401e078712745d96 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 6 Mar 2018 23:19:42 -0500 Subject: [PATCH] update ignore logic to allow paths to start with /, end with /, and include / in the middle --- lib/svi/util.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/svi/util.rb b/lib/svi/util.rb index 0c46a61..13af555 100644 --- a/lib/svi/util.rb +++ b/lib/svi/util.rb @@ -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