Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2017-03-02 16:21:36 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2017-08-28 17:40:25 +0300
commitf0f3f38576c0691e6d0e751c962382beea998afb (patch)
treef67dac1469c8d6ebcf2fb72b336bda278288cbe5 /lib/api/tags.rb
parente80313f9ee5b3495a8713e6ddae111bc8106155b (diff)
Use commit date for branches and tags
Diffstat (limited to 'lib/api/tags.rb')
-rw-r--r--lib/api/tags.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/api/tags.rb b/lib/api/tags.rb
index 1333747cced..81b17935b81 100644
--- a/lib/api/tags.rb
+++ b/lib/api/tags.rb
@@ -65,11 +65,18 @@ module API
delete ':id/repository/tags/:tag_name', requirements: TAG_ENDPOINT_REQUIREMENTS do
authorize_push_project
- result = ::Tags::DestroyService.new(user_project, current_user)
- .execute(params[:tag_name])
+ tag = user_project.repository.find_tag(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
- render_api_error!(result[:message], result[:return_code])
+ if result[:status] != :success
+ render_api_error!(result[:message], result[:return_code])
+ end
end
end