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
8cd83a82
Commit
8cd83a82
authored
Apr 01, 2020
by
Gary Holtz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds some style changes and fixes a performance issue
parent
cec88ba6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/serializers/diffs_entity.rb
app/serializers/diffs_entity.rb
+2
-2
spec/serializers/diffs_entity_spec.rb
spec/serializers/diffs_entity_spec.rb
+2
-2
No files found.
app/serializers/diffs_entity.rb
View file @
8cd83a82
...
...
@@ -16,7 +16,7 @@ class DiffsEntity < Grape::Entity
end
expose
:commit
do
|
diffs
,
options
|
CommitEntity
.
represent
options
[
:commit
],
commit_options
(
options
)
CommitEntity
.
represent
(
options
[
:commit
],
commit_options
(
options
)
)
end
expose
:context_commits
,
using:
API
::
Entities
::
Commit
,
if:
->
(
diffs
,
options
)
{
merge_request
&
.
project
&
.
context_commits_enabled?
}
do
|
diffs
|
...
...
@@ -79,7 +79,7 @@ class DiffsEntity < Grape::Entity
private
def
commit_ids
@commit_ids
||=
merge_request
.
commits
.
collect
(
&
:id
)
@commit_ids
||=
merge_request
.
recent_commits
.
map
(
&
:id
)
end
def
commit_neighbors
(
commit_id
)
...
...
spec/serializers/diffs_entity_spec.rb
View file @
8cd83a82
...
...
@@ -54,7 +54,7 @@ describe DiffsEntity do
let
(
:commit
)
{
commits
.
first
}
it
'includes commit references for nil and next'
do
expect
(
subject
[
:commit
][
:prev_commit_id
]).
to
eq
(
nil
)
expect
(
subject
[
:commit
][
:prev_commit_id
]).
to
be_nil
expect
(
subject
[
:commit
][
:next_commit_id
]).
to
eq
(
commits
.
second
.
id
)
end
end
...
...
@@ -64,7 +64,7 @@ describe DiffsEntity do
it
'includes commit references for previous and nil'
do
expect
(
subject
[
:commit
][
:prev_commit_id
]).
to
eq
(
commits
[
-
2
].
id
)
expect
(
subject
[
:commit
][
:next_commit_id
]).
to
eq
(
nil
)
expect
(
subject
[
:commit
][
:next_commit_id
]).
to
be_nil
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