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
f0f3f385
Commit
f0f3f385
authored
Mar 02, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use commit date for branches and tags
parent
e80313f9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
+23
-9
lib/api/branches.rb
lib/api/branches.rb
+11
-4
lib/api/tags.rb
lib/api/tags.rb
+11
-4
spec/requests/api/tags_spec.rb
spec/requests/api/tags_spec.rb
+1
-1
No files found.
lib/api/branches.rb
View file @
f0f3f385
...
@@ -125,11 +125,18 @@ module API
...
@@ -125,11 +125,18 @@ module API
delete
':id/repository/branches/:branch'
,
requirements:
BRANCH_ENDPOINT_REQUIREMENTS
do
delete
':id/repository/branches/:branch'
,
requirements:
BRANCH_ENDPOINT_REQUIREMENTS
do
authorize_push_project
authorize_push_project
result
=
DeleteBranchService
.
new
(
user_project
,
current_user
)
branch
=
user_project
.
repository
.
find_branch
(
params
[
:branch
])
.
execute
(
params
[
:branch
])
not_found!
(
'Branch'
)
unless
branch
commit
=
user_project
.
repository
.
commit
(
branch
.
dereferenced_target
)
destroy_conditionally!
(
commit
,
last_update_field: :authored_date
)
do
result
=
DeleteBranchService
.
new
(
user_project
,
current_user
)
.
execute
(
params
[
:branch
])
if
result
[
:status
]
!=
:success
if
result
[
:status
]
!=
:success
render_api_error!
(
result
[
:message
],
result
[
:return_code
])
render_api_error!
(
result
[
:message
],
result
[
:return_code
])
end
end
end
end
end
...
...
lib/api/tags.rb
View file @
f0f3f385
...
@@ -65,11 +65,18 @@ module API
...
@@ -65,11 +65,18 @@ module API
delete
':id/repository/tags/:tag_name'
,
requirements:
TAG_ENDPOINT_REQUIREMENTS
do
delete
':id/repository/tags/:tag_name'
,
requirements:
TAG_ENDPOINT_REQUIREMENTS
do
authorize_push_project
authorize_push_project
result
=
::
Tags
::
DestroyService
.
new
(
user_project
,
current_user
)
tag
=
user_project
.
repository
.
find_tag
(
params
[
:tag_name
])
.
execute
(
params
[
:tag_name
])
not_found!
(
'Tag'
)
unless
tag
commit
=
user_project
.
repository
.
commit
(
tag
.
dereferenced_target
)
destroy_conditionally!
(
commit
,
last_update_field: :authored_date
)
do
result
=
::
Tags
::
DestroyService
.
new
(
user_project
,
current_user
)
.
execute
(
params
[
:tag_name
])
if
result
[
:status
]
!=
:success
if
result
[
:status
]
!=
:success
render_api_error!
(
result
[
:message
],
result
[
:return_code
])
render_api_error!
(
result
[
:message
],
result
[
:return_code
])
end
end
end
end
end
...
...
spec/requests/api/tags_spec.rb
View file @
f0f3f385
...
@@ -394,7 +394,7 @@ describe API::Tags do
...
@@ -394,7 +394,7 @@ describe API::Tags do
it_behaves_like
'404 response'
do
it_behaves_like
'404 response'
do
let
(
:request
)
{
put
api
(
route
,
current_user
),
description:
new_description
}
let
(
:request
)
{
put
api
(
route
,
current_user
),
description:
new_description
}
let
(
:message
)
{
'
404 Tag Not Found
'
}
let
(
:message
)
{
'
Tag does not exist
'
}
end
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