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
92615f40
Commit
92615f40
authored
Apr 07, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverse assignment of prev/next_commit_id
parent
f992a23d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
app/serializers/diffs_entity.rb
app/serializers/diffs_entity.rb
+1
-1
spec/serializers/diffs_entity_spec.rb
spec/serializers/diffs_entity_spec.rb
+8
-8
No files found.
app/serializers/diffs_entity.rb
View file @
92615f40
...
...
@@ -99,7 +99,7 @@ class DiffsEntity < Grape::Entity
end
def
commit_options
(
options
)
prev_commit_id
,
next
_commit_id
=
*
commit_neighbors
(
options
[
:commit
]
&
.
id
)
next_commit_id
,
prev
_commit_id
=
*
commit_neighbors
(
options
[
:commit
]
&
.
id
)
options
.
merge
(
type: :full
,
...
...
spec/serializers/diffs_entity_spec.rb
View file @
92615f40
...
...
@@ -45,26 +45,26 @@ describe DiffsEntity do
let
(
:commit
)
{
commits
.
third
}
it
'includes commit references for previous and next'
do
expect
(
subject
[
:commit
][
:
prev
_commit_id
]).
to
eq
(
commits
.
second
.
id
)
expect
(
subject
[
:commit
][
:
next
_commit_id
]).
to
eq
(
commits
.
fourth
.
id
)
expect
(
subject
[
:commit
][
:
next
_commit_id
]).
to
eq
(
commits
.
second
.
id
)
expect
(
subject
[
:commit
][
:
prev
_commit_id
]).
to
eq
(
commits
.
fourth
.
id
)
end
end
context
"when the passed commit is the first in the group"
do
let
(
:commit
)
{
commits
.
first
}
it
'includes commit references for nil and
nex
t'
do
expect
(
subject
[
:commit
][
:
prev
_commit_id
]).
to
be_nil
expect
(
subject
[
:commit
][
:
next
_commit_id
]).
to
eq
(
commits
.
second
.
id
)
it
'includes commit references for nil and
previous commi
t'
do
expect
(
subject
[
:commit
][
:
next
_commit_id
]).
to
be_nil
expect
(
subject
[
:commit
][
:
prev
_commit_id
]).
to
eq
(
commits
.
second
.
id
)
end
end
context
"when the passed commit is the last in the group"
do
let
(
:commit
)
{
commits
.
last
}
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
be_nil
it
'includes commit references for
the next
and nil'
do
expect
(
subject
[
:commit
][
:
next
_commit_id
]).
to
eq
(
commits
[
-
2
].
id
)
expect
(
subject
[
:commit
][
:
prev
_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