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
65ba1dc7
Commit
65ba1dc7
authored
Mar 07, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show hook errors for FF merges
parent
bf163b9d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
app/services/merge_requests/ff_merge_service.rb
app/services/merge_requests/ff_merge_service.rb
+4
-0
changelogs/unreleased-ee/1852-custom-hook-errors-don-t-display-in-merge-request-widget.yml
...tom-hook-errors-don-t-display-in-merge-request-widget.yml
+4
-0
spec/services/merge_requests/ff_merge_service_spec.rb
spec/services/merge_requests/ff_merge_service_spec.rb
+33
-1
No files found.
app/services/merge_requests/ff_merge_service.rb
View file @
65ba1dc7
...
...
@@ -13,6 +13,10 @@ module MergeRequests
source
,
merge_request
.
target_branch
,
merge_request:
merge_request
)
rescue
GitHooksService
::
PreReceiveError
=>
e
raise
MergeError
,
e
.
message
rescue
StandardError
=>
e
raise
MergeError
,
"Something went wrong during merge:
#{
e
.
message
}
"
ensure
merge_request
.
update
(
in_progress_merge_commit_sha:
nil
)
end
...
...
changelogs/unreleased-ee/1852-custom-hook-errors-don-t-display-in-merge-request-widget.yml
0 → 100644
View file @
65ba1dc7
---
title
:
Show hook errors for fast-forward merges
merge_request
:
1375
author
:
spec/services/merge_requests/ff_merge_service_spec.rb
View file @
65ba1dc7
...
...
@@ -16,7 +16,7 @@ describe MergeRequests::FfMergeService do
project
.
team
<<
[
user2
,
:developer
]
end
describe
:execute
do
describe
'#execute'
do
context
'valid params'
do
let
(
:service
)
{
MergeRequests
::
FfMergeService
.
new
(
project
,
user
,
{})
}
...
...
@@ -48,5 +48,37 @@ describe MergeRequests::FfMergeService do
expect
(
note
.
note
).
to
include
'merged'
end
end
context
"error handling"
do
let
(
:service
)
{
MergeRequests
::
FfMergeService
.
new
(
project
,
user
,
commit_message:
'Awesome message'
)
}
before
do
allow
(
Rails
.
logger
).
to
receive
(
:error
)
end
it
'logs and saves error if there is an exception'
do
error_message
=
'error message'
allow
(
service
).
to
receive
(
:repository
).
and_raise
(
"error message"
)
allow
(
service
).
to
receive
(
:execute_hooks
)
service
.
execute
(
merge_request
)
expect
(
merge_request
.
merge_error
).
to
include
(
error_message
)
expect
(
Rails
.
logger
).
to
have_received
(
:error
).
with
(
a_string_matching
(
error_message
))
end
it
'logs and saves error if there is an PreReceiveError exception'
do
error_message
=
'error message'
allow
(
service
).
to
receive
(
:repository
).
and_raise
(
GitHooksService
::
PreReceiveError
,
error_message
)
allow
(
service
).
to
receive
(
:execute_hooks
)
service
.
execute
(
merge_request
)
expect
(
merge_request
.
merge_error
).
to
include
(
error_message
)
expect
(
Rails
.
logger
).
to
have_received
(
:error
).
with
(
a_string_matching
(
error_message
))
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