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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b079a6b6
Commit
b079a6b6
authored
Feb 15, 2019
by
Olivier Gonzalez
Committed by
Grzegorz Bizon
Feb 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Base pipeline must be from target branch
parent
ecb1411f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
changelogs/unreleased/57671-fix_merge_request_base_pipeline.yml
...logs/unreleased/57671-fix_merge_request_base_pipeline.yml
+5
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+2
-1
No files found.
app/models/merge_request.rb
View file @
b079a6b6
...
@@ -1322,7 +1322,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -1322,7 +1322,7 @@ class MergeRequest < ActiveRecord::Base
def
base_pipeline
def
base_pipeline
@base_pipeline
||=
project
.
ci_pipelines
@base_pipeline
||=
project
.
ci_pipelines
.
order
(
id: :desc
)
.
order
(
id: :desc
)
.
find_by
(
sha:
diff_base_sha
)
.
find_by
(
sha:
diff_base_sha
,
ref:
target_branch
)
end
end
def
discussions_rendered_on_frontend?
def
discussions_rendered_on_frontend?
...
...
changelogs/unreleased/57671-fix_merge_request_base_pipeline.yml
0 → 100644
View file @
b079a6b6
---
title
:
Ensure the base pipeline of a Merge Request belongs to its target branch
merge_request
:
25226
author
:
type
:
fixed
spec/models/merge_request_spec.rb
View file @
b079a6b6
...
@@ -2604,8 +2604,9 @@ describe MergeRequest do
...
@@ -2604,8 +2604,9 @@ describe MergeRequest do
let!
(
:first_pipeline
)
{
create
(
:ci_pipeline_without_jobs
,
pipeline_arguments
)
}
let!
(
:first_pipeline
)
{
create
(
:ci_pipeline_without_jobs
,
pipeline_arguments
)
}
let!
(
:last_pipeline
)
{
create
(
:ci_pipeline_without_jobs
,
pipeline_arguments
)
}
let!
(
:last_pipeline
)
{
create
(
:ci_pipeline_without_jobs
,
pipeline_arguments
)
}
let!
(
:last_pipeline_with_other_ref
)
{
create
(
:ci_pipeline_without_jobs
,
pipeline_arguments
.
merge
(
ref:
'other'
))
}
it
'returns latest pipeline'
do
it
'returns latest pipeline
for the target branch
'
do
expect
(
merge_request
.
base_pipeline
).
to
eq
(
last_pipeline
)
expect
(
merge_request
.
base_pipeline
).
to
eq
(
last_pipeline
)
end
end
end
end
...
...
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