Method: Projects::CommitController#revert

Defined in:
app/controllers/projects/commit_controller.rb

#revertObject



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'app/controllers/projects/commit_controller.rb', line 147

def revert
  return render_404 unless @commit

  assign_change_commit_vars
  @commit_params[:revert] = true

  return render_404 if @start_branch.blank?

  @branch_name = create_new_branch? ? @commit.revert_branch_name : @start_branch

  create_commit(
    Commits::RevertService,
    success_notice: "The #{@commit.change_type_title(current_user)} has been successfully reverted.",
    success_path: -> { successful_change_path(@project) },
    failure_path: failed_change_path
  )
end