BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
94a7198a
Unverified
Commit
94a7198a
authored
Aug 15, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merge request diff create and head_commit_sha compatibility
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
29ac60d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
merge_request_diff.rb
app/models/merge_request_diff.rb
+14
-3
No files found.
app/models/merge_request_diff.rb
View file @
94a7198a
...
...
@@ -42,8 +42,19 @@ class MergeRequestDiff < ActiveRecord::Base
def
ensure_commits_sha
self
.
start_commit_sha
||=
merge_request
.
target_branch_sha
self
.
head_commit_sha
||=
last_commit
.
try
(
:sha
)
||
merge_request
.
source_branch_sha
self
.
head_commit_sha
||=
merge_request
.
source_branch_sha
self
.
base_commit_sha
||=
find_base_sha
save
end
# Override head_commit_sha to keep compatibility with merge request diff
# created before version 8.4 that does not store head_commit_sha in separate db field.
def
head_commit_sha
if
persisted?
&&
super
.
nil?
last_commit
.
try
(
:sha
)
else
super
end
end
# This method will rely on repository branch sha
...
...
@@ -57,7 +68,7 @@ class MergeRequestDiff < ActiveRecord::Base
# in case head_commit_sha is nil. Its necesarry for old merge request diff
# created before version 8.4 to work
def
safe_head_commit_sha
head_commit_sha
||
last_commit
.
try
(
:sha
)
||
merge_request
.
source_branch_sha
head_commit_sha
||
merge_request
.
source_branch_sha
end
def
size
...
...
@@ -111,7 +122,7 @@ class MergeRequestDiff < ActiveRecord::Base
end
def
head_commit
return
last_commit
unless
head_commit_sha
return
unless
head_commit_sha
project
.
commit
(
head_commit_sha
)
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