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
aea08697
Commit
aea08697
authored
Aug 20, 2021
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose web_url to Compare API endpoint
Changelog: added
parent
9841861b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
doc/api/repositories.md
doc/api/repositories.md
+2
-1
lib/api/entities/compare.rb
lib/api/entities/compare.rb
+4
-0
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+6
-0
No files found.
doc/api/repositories.md
View file @
aea08697
...
@@ -200,7 +200,8 @@ Example response:
...
@@ -200,7 +200,8 @@ Example response:
"deleted_file"
:
false
"deleted_file"
:
false
}],
}],
"compare_timeout"
:
false
,
"compare_timeout"
:
false
,
"compare_same_ref"
:
false
"compare_same_ref"
:
false
,
"web_url"
:
"https://gitlab.example.com/thedude/gitlab-foss/-/compare/ae73cb07c9eeaf35924a10f713b364d32b2dd34f...0b4bc9a49b562e85de7cc9e834518ea6828729b9"
}
}
```
```
...
...
lib/api/entities/compare.rb
View file @
aea08697
...
@@ -20,6 +20,10 @@ module API
...
@@ -20,6 +20,10 @@ module API
end
end
expose
:same
,
as: :compare_same_ref
expose
:same
,
as: :compare_same_ref
expose
:web_url
do
|
compare
,
_
|
Gitlab
::
UrlBuilder
.
build
(
compare
)
end
end
end
end
end
end
end
spec/requests/api/repositories_spec.rb
View file @
aea08697
...
@@ -354,6 +354,7 @@ RSpec.describe API::Repositories do
...
@@ -354,6 +354,7 @@ RSpec.describe API::Repositories do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
end
end
it
"compares branches with explicit merge-base mode"
do
it
"compares branches with explicit merge-base mode"
do
...
@@ -365,6 +366,7 @@ RSpec.describe API::Repositories do
...
@@ -365,6 +366,7 @@ RSpec.describe API::Repositories do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
end
end
it
"compares branches with explicit straight mode"
do
it
"compares branches with explicit straight mode"
do
...
@@ -376,6 +378,7 @@ RSpec.describe API::Repositories do
...
@@ -376,6 +378,7 @@ RSpec.describe API::Repositories do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
end
end
it
"compares tags"
do
it
"compares tags"
do
...
@@ -384,6 +387,7 @@ RSpec.describe API::Repositories do
...
@@ -384,6 +387,7 @@ RSpec.describe API::Repositories do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
end
end
it
"compares commits"
do
it
"compares commits"
do
...
@@ -393,6 +397,7 @@ RSpec.describe API::Repositories do
...
@@ -393,6 +397,7 @@ RSpec.describe API::Repositories do
expect
(
json_response
[
'commits'
]).
to
be_empty
expect
(
json_response
[
'commits'
]).
to
be_empty
expect
(
json_response
[
'diffs'
]).
to
be_empty
expect
(
json_response
[
'diffs'
]).
to
be_empty
expect
(
json_response
[
'compare_same_ref'
]).
to
be_falsey
expect
(
json_response
[
'compare_same_ref'
]).
to
be_falsey
expect
(
json_response
[
'web_url'
]).
to
be_present
end
end
it
"compares commits in reverse order"
do
it
"compares commits in reverse order"
do
...
@@ -401,6 +406,7 @@ RSpec.describe API::Repositories do
...
@@ -401,6 +406,7 @@ RSpec.describe API::Repositories do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'commits'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'diffs'
]).
to
be_present
expect
(
json_response
[
'web_url'
]).
to
be_present
end
end
it
"compare commits between different projects with non-forked relation"
do
it
"compare commits between different projects with non-forked relation"
do
...
...
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