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
Tatuya Kamada
gitlab-ce
Commits
6a46926f
Commit
6a46926f
authored
Jul 06, 2016
by
Sean McGivern
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused argument to CompareService#execute
parent
4add7f65
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
app/controllers/projects/compare_controller.rb
app/controllers/projects/compare_controller.rb
+10
-4
app/services/compare_service.rb
app/services/compare_service.rb
+1
-1
No files found.
app/controllers/projects/compare_controller.rb
View file @
6a46926f
...
@@ -14,7 +14,7 @@ class Projects::CompareController < Projects::ApplicationController
...
@@ -14,7 +14,7 @@ class Projects::CompareController < Projects::ApplicationController
def
show
def
show
compare
=
CompareService
.
new
.
compare
=
CompareService
.
new
.
execute
(
@project
,
@head_ref
,
@project
,
@start_ref
,
diff_options
)
execute
(
@project
,
@head_ref
,
@project
,
@start_ref
)
if
compare
if
compare
@commits
=
Commit
.
decorate
(
compare
.
commits
,
@project
)
@commits
=
Commit
.
decorate
(
compare
.
commits
,
@project
)
...
@@ -37,18 +37,24 @@ class Projects::CompareController < Projects::ApplicationController
...
@@ -37,18 +37,24 @@ class Projects::CompareController < Projects::ApplicationController
def
diff_for_path
def
diff_for_path
compare
=
CompareService
.
new
.
compare
=
CompareService
.
new
.
execute
(
@project
,
@head_ref
,
@project
,
@
base_ref
,
diff_options
)
execute
(
@project
,
@head_ref
,
@project
,
@
start_ref
)
return
render_404
unless
compare
return
render_404
unless
compare
@start_commit
=
@project
.
commit
(
@start_ref
)
@commit
=
@project
.
commit
(
@head_ref
)
@commit
=
@project
.
commit
(
@head_ref
)
@base_commit
=
@project
.
merge_base_commit
(
@
base
_ref
,
@head_ref
)
@base_commit
=
@project
.
merge_base_commit
(
@
start
_ref
,
@head_ref
)
diffs
=
compare
.
diffs
(
diff_options
.
merge
(
paths:
[
params
[
:path
]]))
diffs
=
compare
.
diffs
(
diff_options
.
merge
(
paths:
[
params
[
:path
]]))
diff_refs
=
Gitlab
::
Diff
::
DiffRefs
.
new
(
base_sha:
@base_commit
.
try
(
:sha
),
start_sha:
@start_commit
.
try
(
:sha
),
head_sha:
@commit
.
try
(
:sha
)
)
@diff_notes_disabled
=
true
@diff_notes_disabled
=
true
@grouped_diff_notes
=
{}
@grouped_diff_notes
=
{}
render_diff_for_path
(
diffs
,
[
@base_commit
,
@commit
]
,
@project
)
render_diff_for_path
(
diffs
,
diff_refs
,
@project
)
end
end
def
create
def
create
...
...
app/services/compare_service.rb
View file @
6a46926f
...
@@ -3,7 +3,7 @@ require 'securerandom'
...
@@ -3,7 +3,7 @@ require 'securerandom'
# Compare 2 branches for one repo or between repositories
# Compare 2 branches for one repo or between repositories
# and return Gitlab::Git::Compare object that responds to commits and diffs
# and return Gitlab::Git::Compare object that responds to commits and diffs
class
CompareService
class
CompareService
def
execute
(
source_project
,
source_branch
,
target_project
,
target_branch
,
diff_options
=
{}
)
def
execute
(
source_project
,
source_branch
,
target_project
,
target_branch
)
source_commit
=
source_project
.
commit
(
source_branch
)
source_commit
=
source_project
.
commit
(
source_branch
)
return
unless
source_commit
return
unless
source_commit
...
...
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