Simplify merge_ref_head methods
This commit is contained in:
parent
b965009ddd
commit
96db70a444
|
@ -1080,16 +1080,14 @@ class MergeRequest < ApplicationRecord
|
|||
|
||||
# Returns the current merge-ref HEAD commit.
|
||||
#
|
||||
# Consider calling mergeability_check method _before_ this if you need
|
||||
# the latest possible version of it (it's already automatically updated
|
||||
# along the merge_status).
|
||||
#
|
||||
def merge_ref_head
|
||||
project.repository.commit(merge_ref_path)
|
||||
end
|
||||
|
||||
# Returns the updated merge-ref HEAD commit.
|
||||
#
|
||||
def merge_ref_head!
|
||||
merge_ref_head if check_mergeability.success?
|
||||
end
|
||||
|
||||
def ref_path
|
||||
"refs/#{Repository::REF_MERGE_REQUEST}/#{iid}/head"
|
||||
end
|
||||
|
|
|
@ -1159,7 +1159,7 @@ Parameters:
|
|||
}
|
||||
```
|
||||
|
||||
## Return up to date merge-ref
|
||||
## Returns the up to date merge-ref HEAD commit
|
||||
|
||||
Merge the changes between the merge request source and target branches into `refs/merge-requests/:iid/merge`
|
||||
ref, of the target project repository, if possible. This ref will have the state the target branch would have if
|
||||
|
|
|
@ -398,11 +398,11 @@ module API
|
|||
present merge_request, with: Entities::MergeRequest, current_user: current_user, project: user_project
|
||||
end
|
||||
|
||||
desc 'Returns an up to date merge-ref HEAD'
|
||||
desc 'Returns the up to date merge-ref HEAD commit'
|
||||
get ':id/merge_requests/:merge_request_iid/merge_ref' do
|
||||
merge_request = find_project_merge_request(params[:merge_request_iid])
|
||||
|
||||
result = merge_request.check_mergeability
|
||||
result = ::MergeRequests::MergeabilityCheckService.new(merge_request).execute
|
||||
|
||||
if result.success? && commit = merge_request.merge_ref_head
|
||||
present :commit_id, commit.sha
|
||||
|
|
Loading…
Reference in New Issue