diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2017-03-02 14:21:36 +0100 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2017-08-28 16:40:25 +0200 |
commit | f0f3f38576c0691e6d0e751c962382beea998afb (patch) | |
tree | f67dac1469c8d6ebcf2fb72b336bda278288cbe5 /lib/api/branches.rb | |
parent | e80313f9ee5b3495a8713e6ddae111bc8106155b (diff) | |
download | gitlab-ce-f0f3f38576c0691e6d0e751c962382beea998afb.tar.gz |
Use commit date for branches and tags
Diffstat (limited to 'lib/api/branches.rb')
-rw-r--r-- | lib/api/branches.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/api/branches.rb b/lib/api/branches.rb index d3dbf941298..b87f7cdbad1 100644 --- a/lib/api/branches.rb +++ b/lib/api/branches.rb @@ -125,11 +125,18 @@ module API delete ':id/repository/branches/:branch', requirements: BRANCH_ENDPOINT_REQUIREMENTS do authorize_push_project - result = DeleteBranchService.new(user_project, current_user) - .execute(params[:branch]) + 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]) - 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 |