2014-09-02 18:07:02 +05:30
|
|
|
class Projects::RepositoriesController < Projects::ApplicationController
|
|
|
|
# Authorize
|
2015-09-11 14:41:01 +05:30
|
|
|
before_action :require_non_empty_project, except: :create
|
|
|
|
before_action :authorize_download_code!
|
|
|
|
before_action :authorize_admin_project!, only: :create
|
2014-09-02 18:07:02 +05:30
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
def create
|
|
|
|
@project.create_repository
|
|
|
|
|
|
|
|
redirect_to project_path(@project)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def archive
|
2016-06-16 23:09:34 +05:30
|
|
|
send_git_archive @repository, ref: params[:ref], format: params[:format]
|
2015-10-24 18:46:33 +05:30
|
|
|
rescue => ex
|
|
|
|
logger.error("#{self.class.name}: #{ex}")
|
|
|
|
return git_not_found!
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|