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
Tatuya Kamada
gitlab-ce
Commits
c2f0ae8a
Commit
c2f0ae8a
authored
Oct 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7850 from asedge/api_add_tag_message
Finish up work on annotated tags
parents
f99b8768
822d9aa6
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
18 deletions
+47
-18
CHANGELOG
CHANGELOG
+1
-0
app/views/projects/tags/_tag.html.haml
app/views/projects/tags/_tag.html.haml
+3
-0
doc/api/repositories.md
doc/api/repositories.md
+3
-1
lib/api/entities.rb
lib/api/entities.rb
+19
-0
lib/api/repositories.rb
lib/api/repositories.rb
+3
-2
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+18
-15
No files found.
CHANGELOG
View file @
c2f0ae8a
...
...
@@ -4,6 +4,7 @@ v 7.5.0
- Fix LDAP authentication for Git HTTP access
- Fix LDAP config lookup for provider 'ldap'
- Add Atlassian Bamboo CI service (Drew Blessing)
- Tie up loose ends with annotated tags: API & UI (Sean Edge)
v 7.4.2
- Fix internal snippet exposing for unauthenticated users
...
...
app/views/projects/tags/_tag.html.haml
View file @
c2f0ae8a
...
...
@@ -4,6 +4,9 @@
=
link_to
project_commits_path
(
@project
,
tag
.
name
),
class:
""
do
%i
.fa.fa-tag
=
tag
.
name
-
if
tag
.
message
.
present?
=
tag
.
message
.pull-right
-
if
can?
current_user
,
:download_code
,
@project
=
render
'projects/repositories/download_archive'
,
ref:
tag
.
name
,
btn_class:
'btn-grouped btn-group-small'
...
...
doc/api/repositories.md
View file @
c2f0ae8a
...
...
@@ -56,6 +56,7 @@ Parameters:
[
{
"name"
:
"v1.0.0"
,
"message"
:
"Release 1.0.0"
,
"commit"
:
{
"id"
:
"2695effb5807a22ff3d138d593fd856244e155e7"
,
"parents"
:
[],
...
...
@@ -67,10 +68,11 @@ Parameters:
"committed_date"
:
"2012-05-28T04:42:42-07:00"
,
"committer_email"
:
"jack@example.com"
},
"protected"
:
false
}
]
```
The message will be
`nil`
when creating a lightweight tag otherwise
it will contain the annotation.
It returns 200 if the operation succeed. In case of an error,
405 with an explaining error message is returned.
...
...
lib/api/entities.rb
View file @
c2f0ae8a
...
...
@@ -73,6 +73,25 @@ module API
end
end
class
RepoTag
<
Grape
::
Entity
expose
:name
expose
:message
do
|
repo_obj
,
_options
|
if
repo_obj
.
respond_to?
(
:message
)
repo_obj
.
message
else
nil
end
end
expose
:commit
do
|
repo_obj
,
options
|
if
repo_obj
.
respond_to?
(
:commit
)
repo_obj
.
commit
elsif
options
[
:project
]
options
[
:project
].
repository
.
commit
(
repo_obj
.
target
)
end
end
end
class
RepoObject
<
Grape
::
Entity
expose
:name
...
...
lib/api/repositories.rb
View file @
c2f0ae8a
...
...
@@ -23,7 +23,8 @@ module API
# Example Request:
# GET /projects/:id/repository/tags
get
":id/repository/tags"
do
present
user_project
.
repo
.
tags
.
sort_by
(
&
:name
).
reverse
,
with:
Entities
::
RepoObject
,
project:
user_project
present
user_project
.
repo
.
tags
.
sort_by
(
&
:name
).
reverse
,
with:
Entities
::
RepoTag
,
project:
user_project
end
# Create tag
...
...
@@ -43,7 +44,7 @@ module API
if
result
[
:status
]
==
:success
present
result
[
:tag
],
with:
Entities
::
Repo
Object
,
with:
Entities
::
Repo
Tag
,
project:
user_project
else
render_api_error!
(
result
[
:message
],
400
)
...
...
spec/requests/api/repositories_spec.rb
View file @
c2f0ae8a
...
...
@@ -34,21 +34,24 @@ describe API::API, api: true do
end
end
# TODO: fix this test for CI
#context 'annotated tag' do
#it 'should create a new annotated tag' do
#post api("/projects/#{project.id}/repository/tags", user),
#tag_name: 'v7.1.0',
#ref: 'master',
#message: 'tag message'
#response.status.should == 201
#json_response['name'].should == 'v7.1.0'
# The message is not part of the JSON response.
# Additional changes to the gitlab_git gem may be required.
# json_response['message'].should == 'tag message'
#end
#end
context
'annotated tag'
do
it
'should create a new annotated tag'
do
# Identity must be set in .gitconfig to create annotated tag.
repo_path
=
File
.
join
(
Gitlab
.
config
.
gitlab_shell
.
repos_path
,
project
.
path_with_namespace
+
'.git'
)
system
(
*
%W(git --git-dir=
#{
repo_path
}
config user.name
#{
user
.
name
}
)
)
system
(
*
%W(git --git-dir=
#{
repo_path
}
config user.email
#{
user
.
email
}
)
)
post
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user
),
tag_name:
'v7.1.0'
,
ref:
'master'
,
message:
'Release 7.1.0'
response
.
status
.
should
==
201
json_response
[
'name'
].
should
==
'v7.1.0'
json_response
[
'message'
].
should
==
'Release 7.1.0'
end
end
it
'should deny for user without push access'
do
post
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user2
),
...
...
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