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
Léo-Paul Géneau
gitlab-ce
Commits
eb355dec
Commit
eb355dec
authored
Aug 22, 2016
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore diff_sha_refs method
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9329436d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
19 deletions
+24
-19
app/models/diff_note.rb
app/models/diff_note.rb
+5
-1
app/models/merge_request.rb
app/models/merge_request.rb
+16
-15
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+3
-3
No files found.
app/models/diff_note.rb
View file @
eb355dec
...
...
@@ -118,8 +118,12 @@ class DiffNote < Note
end
def
noteable_diff_refs
if
noteable
.
respond_to?
(:
diff_sha_refs
)
noteable
.
diff_sha_refs
else
noteable
.
diff_refs
end
end
def
set_original_position
self
.
original_position
=
self
.
position
.
dup
...
...
app/models/merge_request.rb
View file @
eb355dec
...
...
@@ -265,26 +265,27 @@ class MergeRequest < ActiveRecord::Base
@source_branch_sha
||
source_branch_head
.
try
(
:sha
)
end
def
branch_merge_base_sha
branch_merge_base_commit
.
try
(
:sha
)
def
diff_refs
return
unless
diff_start_commit
||
diff_base_commit
Gitlab
::
Diff
::
DiffRefs
.
new
(
base_sha:
diff_base_sha
,
start_sha:
diff_start_sha
,
head_sha:
diff_head_sha
)
end
def
diff_refs
# Return diff_refs instance trying to not touch the git repository
def
diff_sha_refs
if
merge_request_diff
&&
merge_request_diff
.
diff_refs_by_sha?
merge_request_diff
.
diff_refs
else
start_sha
=
target_branch_sha
head_sha
=
source_branch_sha
base_sha
=
branch_merge_base_sha
if
start_sha
||
base_sha
Gitlab
::
Diff
::
DiffRefs
.
new
(
base_sha:
base_sha
,
start_sha:
start_sha
,
head_sha:
head_sha
)
diff_refs
end
end
def
branch_merge_base_sha
branch_merge_base_commit
.
try
(
:sha
)
end
def
validate_branches
...
...
@@ -748,7 +749,7 @@ class MergeRequest < ActiveRecord::Base
end
def
has_complete_diff_refs?
diff_
refs
&&
diff
_refs
.
complete?
diff_
sha_refs
&&
diff_sha
_refs
.
complete?
end
def
update_diff_notes_positions
(
old_diff_refs
:,
new_diff_refs
:)
...
...
spec/models/merge_request_spec.rb
View file @
eb355dec
...
...
@@ -782,7 +782,7 @@ describe MergeRequest, models: true do
end
end
describe
"#diff_refs"
do
describe
"#diff_
sha_
refs"
do
context
"with diffs"
do
subject
{
create
(
:merge_request
,
:with_diffs
)
}
...
...
@@ -791,7 +791,7 @@ describe MergeRequest, models: true do
expect_any_instance_of
(
Repository
).
not_to
receive
(
:commit
)
subject
.
diff_refs
subject
.
diff_
sha_
refs
end
it
"returns expected diff_refs"
do
...
...
@@ -801,7 +801,7 @@ describe MergeRequest, models: true do
head_sha:
subject
.
merge_request_diff
.
head_commit_sha
)
expect
(
subject
.
diff_refs
).
to
eq
(
expected_diff_refs
)
expect
(
subject
.
diff_
sha_
refs
).
to
eq
(
expected_diff_refs
)
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