diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-15 21:09:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-15 21:09:43 +0300 |
commit | f784f7d3b19fe80834240bde23d1300accb01118 (patch) | |
tree | 2acd4a74cbcde10c5b70c356b146af78362862d1 /lib/gitlab/ci/pipeline_object_hierarchy.rb | |
parent | 06c127aa72cff78235426341081837cff0b6f78b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/pipeline_object_hierarchy.rb')
-rw-r--r-- | lib/gitlab/ci/pipeline_object_hierarchy.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/gitlab/ci/pipeline_object_hierarchy.rb b/lib/gitlab/ci/pipeline_object_hierarchy.rb index 55e6cfb1b73..de3262b10e0 100644 --- a/lib/gitlab/ci/pipeline_object_hierarchy.rb +++ b/lib/gitlab/ci/pipeline_object_hierarchy.rb @@ -20,14 +20,26 @@ module Gitlab def ancestor_conditions(cte) middle_table[:source_pipeline_id].eq(objects_table[:id]).and( middle_table[:pipeline_id].eq(cte.table[:id]) + ).and( + same_project_condition ) end def descendant_conditions(cte) middle_table[:pipeline_id].eq(objects_table[:id]).and( middle_table[:source_pipeline_id].eq(cte.table[:id]) + ).and( + same_project_condition ) end + + def same_project_condition + if options[:same_project] + middle_table[:source_project_id].eq(middle_table[:project_id]) + else + Arel.sql('TRUE') + end + end end end end |