diff options
Diffstat (limited to 'app/presenters/ci/build_runner_presenter.rb')
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 6d46e0bf18a..471b6d3b726 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -25,14 +25,16 @@ module Ci end def git_depth - strong_memoize(:git_depth) do - git_depth = variables&.find { |variable| variable[:key] == 'GIT_DEPTH' }&.dig(:value) - git_depth.to_i - end + if git_depth_variable + git_depth_variable[:value] + else + project.default_git_depth + end.to_i end def refspecs specs = [] + specs << refspec_for_merge_request_ref if merge_request_ref? if git_depth > 0 specs << refspec_for_branch(ref) if branch? || legacy_detached_merge_request_pipeline? @@ -42,8 +44,6 @@ module Ci specs << refspec_for_tag end - specs << refspec_for_merge_request_ref if merge_request_ref? - specs end @@ -89,5 +89,11 @@ module Ci def refspec_for_merge_request_ref "+#{ref}:#{ref}" end + + def git_depth_variable + strong_memoize(:git_depth_variable) do + variables&.find { |variable| variable[:key] == 'GIT_DEPTH' } + end + end end end |