summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip Krakowski <Filip.Krakowski@Uni-Duesseldorf.de>2017-06-05 17:15:15 +0200
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-06-08 00:34:59 +0900
commit1736a2dab6bcab8bb5632e211525bd806bef003a (patch)
tree265376a3d7a84245e453e04f03f991eb4e3b7cac
parent7d16f698d575c5988820699e8ec164638b701b50 (diff)
downloadgitlab-ce-1736a2dab6bcab8bb5632e211525bd806bef003a.tar.gz
Fix change in behavior
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index feac7c87466..a58af73debb 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -207,15 +207,19 @@ module Ci
def matching?(patterns, ref, tag, source)
patterns.any? do |pattern|
- match_ref?(pattern, ref, tag) || match_source?(pattern, source)
+ pattern, path = pattern.split('@', 2)
+ match_path?(path) && match_pattern?(pattern, ref, tag, source)
end
end
- def match_ref?(pattern, ref, tag)
- pattern, path = pattern.split('@', 2)
- return false if path && path != self.path
+ def match_path?(path)
+ return !(path && path != self.path)
+ end
+
+ def match_pattern?(pattern, ref, tag, source)
return true if tag && pattern == 'tags'
return true if !tag && pattern == 'branches'
+ return true if source_to_pattern(source) == pattern
if pattern.first == "/" && pattern.last == "/"
Regexp.new(pattern[1...-1]) =~ ref
@@ -224,10 +228,6 @@ module Ci
end
end
- def match_source?(pattern, source)
- return source_to_pattern(source) == pattern
- end
-
def source_to_pattern(source)
return source if %w(api external web).include?(source) || source.nil?
return source.pluralize