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
Boxiang Sun
gitlab-ce
Commits
4cefb568
Commit
4cefb568
authored
Feb 09, 2018
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate feedback
parent
2bbf75f2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
21 deletions
+18
-21
lib/api/commits.rb
lib/api/commits.rb
+15
-14
lib/api/entities.rb
lib/api/entities.rb
+3
-7
No files found.
lib/api/commits.rb
View file @
4cefb568
...
@@ -156,29 +156,30 @@ module API
...
@@ -156,29 +156,30 @@ module API
end
end
end
end
desc
'Get all reference a commit is pushed to'
do
desc
'Get all reference
s
a commit is pushed to'
do
detail
'This feature was introduced in GitLab 10.6'
detail
'This feature was introduced in GitLab 10.6'
success
Entities
::
Simple
Ref
success
Entities
::
Basic
Ref
end
end
params
do
params
do
requires
:sha
,
type:
String
,
desc:
'A commit sha'
requires
:sha
,
type:
String
,
desc:
'A commit sha'
optional
:type
,
type:
String
,
values:
%w
(branches tags all)
,
default:
'all'
,
desc:
'Scope'
optional
:type
,
type:
String
,
values:
%w
[branches tags all]
,
default:
'all'
,
desc:
'Scope'
end
end
get
':id/repository/commits/:sha/refs'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
get
':id/repository/commits/:sha/refs'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
commit
=
user_project
.
commit
(
params
[
:sha
])
commit
=
user_project
.
commit
(
params
[
:sha
])
not_found!
(
'Commit'
)
unless
commit
not_found!
(
'Commit'
)
unless
commit
refs
=
case
params
[
:type
]
case
params
[
:type
]
when
'branches'
when
'branches'
refs
=
user_project
.
repository
.
branch_names_contains
(
commit
.
id
)
user_project
.
repository
.
branch_names_contains
(
commit
.
id
)
when
'tags'
when
'tags'
refs
=
user_project
.
repository
.
tag_names_contains
(
commit
.
id
)
user_project
.
repository
.
tag_names_contains
(
commit
.
id
)
else
else
refs
=
user_project
.
repository
.
branch_names_contains
(
commit
.
id
)
refs
=
user_project
.
repository
.
branch_names_contains
(
commit
.
id
)
refs
.
push
(
*
user_project
.
repository
.
tag_names_contains
(
commit
.
id
))
refs
.
concat
(
user_project
.
repository
.
tag_names_contains
(
commit
.
id
))
end
end
present
refs
,
with:
Entities
::
Simple
Ref
present
refs
,
with:
Entities
::
Basic
Ref
end
end
desc
'Post comment to commit'
do
desc
'Post comment to commit'
do
...
@@ -190,7 +191,7 @@ module API
...
@@ -190,7 +191,7 @@ module API
optional
:path
,
type:
String
,
desc:
'The file path'
optional
:path
,
type:
String
,
desc:
'The file path'
given
:path
do
given
:path
do
requires
:line
,
type:
Integer
,
desc:
'The line number'
requires
:line
,
type:
Integer
,
desc:
'The line number'
requires
:line_type
,
type:
String
,
values:
%w
(new old)
,
default:
'new'
,
desc:
'The type of the line'
requires
:line_type
,
type:
String
,
values:
%w
[new old]
,
default:
'new'
,
desc:
'The type of the line'
end
end
end
end
post
':id/repository/commits/:sha/comments'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
post
':id/repository/commits/:sha/comments'
,
requirements:
API
::
COMMIT_ENDPOINT_REQUIREMENTS
do
...
...
lib/api/entities.rb
View file @
4cefb568
...
@@ -277,16 +277,12 @@ module API
...
@@ -277,16 +277,12 @@ module API
end
end
class
BasicRef
<
Grape
::
Entity
class
BasicRef
<
Grape
::
Entity
expose
:name
end
class
SimpleRef
<
Grape
::
Entity
expose
:name
do
|
ref
,
options
|
expose
:name
do
|
ref
,
options
|
ref
ref
end
end
end
end
class
Branch
<
BasicRef
class
Branch
<
Grape
::
Entity
expose
:name
expose
:name
expose
:commit
,
using:
Entities
::
Commit
do
|
repo_branch
,
options
|
expose
:commit
,
using:
Entities
::
Commit
do
|
repo_branch
,
options
|
...
@@ -855,8 +851,8 @@ module API
...
@@ -855,8 +851,8 @@ module API
expose
:description
expose
:description
end
end
class
Tag
<
BasicRef
class
Tag
<
Grape
::
Entity
expose
:message
expose
:
name
,
:
message
expose
:commit
,
using:
Entities
::
Commit
do
|
repo_tag
,
options
|
expose
:commit
,
using:
Entities
::
Commit
do
|
repo_tag
,
options
|
options
[
:project
].
repository
.
commit
(
repo_tag
.
dereferenced_target
)
options
[
:project
].
repository
.
commit
(
repo_tag
.
dereferenced_target
)
...
...
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