summaryrefslogtreecommitdiff
path: root/app/controllers/projects/repositories_controller.rb
blob: d5af0341d18fda13ee340f78d1b840ffa6d53186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class Projects::RepositoriesController < Projects::ApplicationController
  # Authorize
  before_action :require_non_empty_project, except: :create
  before_action :authorize_download_code!
  before_action :authorize_admin_project!, only: :create

  def create
    @project.create_repository

    redirect_to project_path(@project)
  end

  def archive
    send_git_archive @repository, ref: params[:ref], format: params[:format]
  rescue => ex
    logger.error("#{self.class.name}: #{ex}")
    return git_not_found!
  end
end