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
96db70a4
Commit
96db70a4
authored
May 30, 2019
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify merge_ref_head methods
parent
b965009d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
9 deletions
+7
-9
app/models/merge_request.rb
app/models/merge_request.rb
+4
-6
doc/api/merge_requests.md
doc/api/merge_requests.md
+1
-1
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+2
-2
No files found.
app/models/merge_request.rb
View file @
96db70a4
...
...
@@ -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
...
...
doc/api/merge_requests.md
View file @
96db70a4
...
...
@@ -1159,7 +1159,7 @@ Parameters:
}
```
## Return
up to date merge-ref
## Return
s 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
...
...
lib/api/merge_requests.rb
View file @
96db70a4
...
...
@@ -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
...
...
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