Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
20d4ca4c
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
20d4ca4c
编写于
4月 06, 2016
作者:
R
Robert Schilling
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
API: Ability to retrieve a single tag
上级
8cb41f19
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
76 addition
and
1 deletion
+76
-1
doc/api/tags.md
doc/api/tags.md
+45
-1
lib/api/tags.rb
lib/api/tags.rb
+14
-0
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+17
-0
未找到文件。
doc/api/tags.md
浏览文件 @
20d4ca4c
...
...
@@ -38,6 +38,50 @@ Parameters:
]
```
## Get a single repository tag
Get a specific repository tag determined by its name. It returns 200 together
with the tag information if the tag exists. It returns 404 if the tag does not
exist.
```
GET /projects/:id/repository/tags/:tag_name
```
Parameters:
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`id`
| integer | yes | The ID of a project |
|
`tag_name`
| string | yes | The name of the tag |
```
bash
curl
-H
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/projects/5/repository/tags/v1.0.0
```
Example Response:
```
json
{
"name"
:
"v5.0.0"
,
"message"
:
null
,
"commit"
:
{
"id"
:
"60a8ff033665e1207714d6670fcd7b65304ec02f"
,
"message"
:
"v5.0.0
\n
"
,
"parent_ids"
:
[
"f61c062ff8bcbdb00e0a1b3317a91aed6ceee06b"
],
"authored_date"
:
"2015-02-01T21:56:31.000+01:00"
,
"author_name"
:
"Arthur Verschaeve"
,
"author_email"
:
"contact@arthurverschaeve.be"
,
"committed_date"
:
"2015-02-01T21:56:31.000+01:00"
,
"committer_name"
:
"Arthur Verschaeve"
,
"committer_email"
:
"contact@arthurverschaeve.be"
},
"release"
:
null
}
```
## Create a new tag
Creates a new tag in the repository that points to the supplied ref.
...
...
@@ -148,4 +192,4 @@ Parameters:
"tag_name"
:
"1.0.0"
,
"description"
:
"Amazing release. Wow"
}
```
\ No newline at end of file
```
lib/api/tags.rb
浏览文件 @
20d4ca4c
...
...
@@ -16,6 +16,20 @@ module API
with:
Entities
::
RepoTag
,
project:
user_project
end
# Get a single repository tag
#
# Parameters:
# id (required) - The ID of a project
# tag_name (required) - The name of the tag
# Example Request:
# GET /projects/:id/repository/tags/:tag_name
get
":id/repository/tags/:tag_name"
,
requirements:
{
tag_name:
/.*/
}
do
tag
=
user_project
.
repository
.
find_tag
(
params
[
:tag_name
])
not_found!
(
'Tag'
)
unless
tag
present
tag
,
with:
Entities
::
RepoTag
,
project:
user_project
end
# Create tag
#
# Parameters:
...
...
spec/requests/api/tags_spec.rb
浏览文件 @
20d4ca4c
...
...
@@ -40,6 +40,23 @@ describe API::API, api: true do
end
end
describe
"GET /projects/:id/repository/tags/:tag_name"
do
let
(
:tag_name
)
{
project
.
repository
.
tag_names
.
sort
.
reverse
.
first
}
it
'should return a specific tag'
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags/
#{
tag_name
}
"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'name'
]).
to
eq
(
tag_name
)
end
it
'should return 404 for an invalid tag name'
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/tags/foobar"
,
user
)
expect
(
response
.
status
).
to
eq
(
404
)
end
end
describe
'POST /projects/:id/repository/tags'
do
context
'lightweight tags'
do
it
'should create a new tag'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录