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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
c22e51e8
Commit
c22e51e8
authored
Jun 08, 2018
by
Athar Hameed
Committed by
Sean McGivern
Jun 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Automatically created MR uses wrong target branch (when branching from Tag)"
parent
f068479e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
app/services/merge_requests/create_from_issue_service.rb
app/services/merge_requests/create_from_issue_service.rb
+3
-1
changelogs/unreleased/45400-automatically-created-mr-uses-wrong-target-branch-when-branching-from-tag.yml
...d-mr-uses-wrong-target-branch-when-branching-from-tag.yml
+5
-0
spec/services/merge_requests/create_from_issue_service_spec.rb
...services/merge_requests/create_from_issue_service_spec.rb
+8
-3
No files found.
app/services/merge_requests/create_from_issue_service.rb
View file @
c22e51e8
...
...
@@ -41,7 +41,9 @@ module MergeRequests
end
def
ref
@ref
||
project
.
default_branch
||
'master'
return
@ref
if
project
.
repository
.
branch_exists?
(
@ref
)
project
.
default_branch
||
'master'
end
def
merge_request
...
...
changelogs/unreleased/45400-automatically-created-mr-uses-wrong-target-branch-when-branching-from-tag.yml
0 → 100644
View file @
c22e51e8
---
title
:
Set MR target branch to default branch if target branch is not valid
merge_request
:
19067
author
:
type
:
fixed
spec/services/merge_requests/create_from_issue_service_spec.rb
View file @
c22e51e8
...
...
@@ -125,9 +125,14 @@ describe MergeRequests::CreateFromIssueService do
end
context
'when ref branch does not exist'
do
it
'does not create a merge request'
do
expect
{
described_class
.
new
(
project
,
user
,
issue_iid:
issue
.
iid
,
ref:
'nobr'
).
execute
}
.
not_to
change
{
project
.
merge_requests
.
count
}
subject
{
described_class
.
new
(
project
,
user
,
issue_iid:
issue
.
iid
,
ref:
'no-such-branch'
).
execute
}
it
'creates a merge request'
do
expect
{
subject
}.
to
change
(
project
.
merge_requests
,
:count
).
by
(
1
)
end
it
'sets the merge request target branch to the project default branch'
do
expect
(
subject
[
:merge_request
].
target_branch
).
to
eq
(
project
.
default_branch
)
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