Commit b772e7f4 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Match a dot in paths configured for only: changes

parent 0f78ceca
......@@ -11,7 +11,9 @@ module Gitlab
return true unless pipeline.branch_updated?
pipeline.modified_paths.any? do |path|
@globs.any? { |glob| File.fnmatch?(glob, path, File::FNM_PATHNAME) }
@globs.any? do |glob|
File.fnmatch?(glob, path, File::FNM_PATHNAME | File::FNM_DOTMATCH)
end
end
end
end
......
......@@ -19,7 +19,7 @@ describe Gitlab::Ci::Build::Policy::Changes do
before do
allow(pipeline).to receive(:modified_paths) do
%w[some/modified/ruby/file.rb some/other_file.txt]
%w[some/modified/ruby/file.rb some/other_file.txt some/.dir/file]
end
end
......@@ -42,6 +42,12 @@ describe Gitlab::Ci::Build::Policy::Changes do
expect(policy).to be_satisfied_by(pipeline, seed)
end
it 'is satisfied by matching a pattern with a dot' do
policy = described_class.new(%w[some/*/file])
expect(policy).to be_satisfied_by(pipeline, seed)
end
it 'is not satisfied when pattern does not match path' do
policy = described_class.new(%w[some/*.rb])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment