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
Boxiang Sun
gitlab-ce
Commits
ca275561
Commit
ca275561
authored
6 years ago
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Never set special MR titles for external issues
parent
44c8f919
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
app/services/merge_requests/build_service.rb
app/services/merge_requests/build_service.rb
+2
-6
spec/services/merge_requests/build_service_spec.rb
spec/services/merge_requests/build_service_spec.rb
+22
-0
No files found.
app/services/merge_requests/build_service.rb
View file @
ca275561
...
@@ -154,13 +154,9 @@ module MergeRequests
...
@@ -154,13 +154,9 @@ module MergeRequests
end
end
def
assign_title_from_issue
def
assign_title_from_issue
return
unless
issue
return
unless
issue
&&
issue
.
is_a?
(
Issue
)
merge_request
.
title
=
merge_request
.
title
=
"Resolve
\"
#{
issue
.
title
}
\"
"
case
issue
when
Issue
then
"Resolve
\"
#{
issue
.
title
}
\"
"
when
ExternalIssue
then
merge_request
.
source_branch
.
titleize
.
humanize
end
end
end
def
issue_iid
def
issue_iid
...
...
This diff is collapsed.
Click to expand it.
spec/services/merge_requests/build_service_spec.rb
View file @
ca275561
...
@@ -171,6 +171,24 @@ describe MergeRequests::BuildService do
...
@@ -171,6 +171,24 @@ describe MergeRequests::BuildService do
end
end
end
end
end
end
context
'branch starts with external issue IID followed by a hyphen'
do
let
(
:source_branch
)
{
'12345-fix-issue'
}
before
do
allow
(
project
).
to
receive
(
:external_issue_tracker
).
and_return
(
true
)
end
it
'uses the title of the commit as the title of the merge request'
do
expect
(
merge_request
.
title
).
to
eq
(
commit_1
.
safe_message
.
split
(
"
\n
"
).
first
)
end
it
'uses the description of the commit as the description of the merge request and appends the closes text'
do
commit_description
=
commit_1
.
safe_message
.
split
(
/\n+/
,
2
).
last
expect
(
merge_request
.
description
).
to
eq
(
"
#{
commit_description
}
\n\n
Closes #12345"
)
end
end
end
end
context
'more than one commit in the diff'
do
context
'more than one commit in the diff'
do
...
@@ -244,6 +262,10 @@ describe MergeRequests::BuildService do
...
@@ -244,6 +262,10 @@ describe MergeRequests::BuildService do
it
'sets the title to the humanized branch title'
do
it
'sets the title to the humanized branch title'
do
expect
(
merge_request
.
title
).
to
eq
(
'12345 fix issue'
)
expect
(
merge_request
.
title
).
to
eq
(
'12345 fix issue'
)
end
end
it
'appends the closes text'
do
expect
(
merge_request
.
description
).
to
eq
(
'Closes #12345'
)
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
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