summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-11-26 15:43:46 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-12-08 19:28:56 +0100
commita1be58097943f7f568de6a90aa12cf7452ac2f0a (patch)
tree00bb9628462db4690b6898b1c0e1fb528ee3722a /lib
parent9f6d228d2368911befc11038d64ccb9ccae131ad (diff)
downloadgitlab-ce-a1be58097943f7f568de6a90aa12cf7452ac2f0a.tar.gz
Implement Command#ambiguous_ref?
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/pipeline/chain/command.rb6
-rw-r--r--lib/gitlab/ci/pipeline/chain/validate/repository.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/command.rb b/lib/gitlab/ci/pipeline/chain/command.rb
index 316c283d90b..90208352c55 100644
--- a/lib/gitlab/ci/pipeline/chain/command.rb
+++ b/lib/gitlab/ci/pipeline/chain/command.rb
@@ -57,6 +57,12 @@ module Gitlab
project.protected_for?(origin_ref)
end
end
+
+ def ambiguous_ref?
+ strong_memoize(:ambiguous_ref) do
+ project.repository.ambiguous_ref?(origin_ref)
+ end
+ end
end
end
end
diff --git a/lib/gitlab/ci/pipeline/chain/validate/repository.rb b/lib/gitlab/ci/pipeline/chain/validate/repository.rb
index 09b3187569c..9c6c2bc8e25 100644
--- a/lib/gitlab/ci/pipeline/chain/validate/repository.rb
+++ b/lib/gitlab/ci/pipeline/chain/validate/repository.rb
@@ -17,7 +17,7 @@ module Gitlab
return error('Commit not found')
end
- if @command.project.repository.ambiguous_ref?(@command.origin_ref)
+ if @command.ambiguous_ref?
return error('Ref is ambiguous')
end
end