BigW Consortium Gitlab

Commit f0f3f385 by Robert Schilling

Use commit date for branches and tags

parent e80313f9
......@@ -125,6 +125,12 @@ module API
delete ':id/repository/branches/:branch', requirements: BRANCH_ENDPOINT_REQUIREMENTS do
authorize_push_project
branch = user_project.repository.find_branch(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])
......@@ -132,6 +138,7 @@ module API
render_api_error!(result[:message], result[:return_code])
end
end
end
desc 'Delete all merged branches'
delete ':id/repository/merged_branches' do
......
......@@ -65,6 +65,12 @@ module API
delete ':id/repository/tags/:tag_name', requirements: TAG_ENDPOINT_REQUIREMENTS do
authorize_push_project
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])
......@@ -72,6 +78,7 @@ module API
render_api_error!(result[:message], result[:return_code])
end
end
end
desc 'Add a release note to a tag' do
success Entities::Release
......
......@@ -394,7 +394,7 @@ describe API::Tags do
it_behaves_like '404 response' do
let(:request) { put api(route, current_user), description: new_description }
let(:message) { '404 Tag Not Found' }
let(:message) { 'Tag does not exist' }
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment