Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
b772e7f4
Commit
b772e7f4
authored
Oct 02, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Match a dot in paths configured for only: changes
parent
0f78ceca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
lib/gitlab/ci/build/policy/changes.rb
lib/gitlab/ci/build/policy/changes.rb
+3
-1
spec/lib/gitlab/ci/build/policy/changes_spec.rb
spec/lib/gitlab/ci/build/policy/changes_spec.rb
+7
-1
No files found.
lib/gitlab/ci/build/policy/changes.rb
View file @
b772e7f4
...
@@ -11,7 +11,9 @@ module Gitlab
...
@@ -11,7 +11,9 @@ module Gitlab
return
true
unless
pipeline
.
branch_updated?
return
true
unless
pipeline
.
branch_updated?
pipeline
.
modified_paths
.
any?
do
|
path
|
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
end
end
end
...
...
spec/lib/gitlab/ci/build/policy/changes_spec.rb
View file @
b772e7f4
...
@@ -19,7 +19,7 @@ describe Gitlab::Ci::Build::Policy::Changes do
...
@@ -19,7 +19,7 @@ describe Gitlab::Ci::Build::Policy::Changes do
before
do
before
do
allow
(
pipeline
).
to
receive
(
:modified_paths
)
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
end
end
...
@@ -42,6 +42,12 @@ describe Gitlab::Ci::Build::Policy::Changes do
...
@@ -42,6 +42,12 @@ describe Gitlab::Ci::Build::Policy::Changes do
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
expect
(
policy
).
to
be_satisfied_by
(
pipeline
,
seed
)
end
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
it
'is not satisfied when pattern does not match path'
do
policy
=
described_class
.
new
(
%w[some/*.rb]
)
policy
=
described_class
.
new
(
%w[some/*.rb]
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment