diff options
Diffstat (limited to 'app/controllers/projects/repositories_controller.rb')
-rw-r--r-- | app/controllers/projects/repositories_controller.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb new file mode 100644 index 00000000000..b65af029803 --- /dev/null +++ b/app/controllers/projects/repositories_controller.rb @@ -0,0 +1,41 @@ +class Projects::RepositoriesController < Projects::ApplicationController + # Authorize + before_filter :authorize_read_project! + before_filter :authorize_code_access! + before_filter :require_non_empty_project + + def show + @activities = @repository.commits_with_refs(20) + end + + def branches + @branches = @repository.branches + end + + def tags + @tags = @repository.tags + end + + def stats + @stats = Gitlab::Git::Stats.new(@repository.raw, @repository.root_ref) + @graph = @stats.graph + end + + def archive + unless can?(current_user, :download_code, @project) + render_404 and return + end + + + storage_path = Rails.root.join("tmp", "repositories") + + file_path = @repository.archive_repo(params[:ref], storage_path) + + if file_path + # Send file to user + send_file file_path + else + render_404 + end + end +end |