BigW Consortium Gitlab

repositories_controller.rb 767 Bytes
Newer Older
1
class RepositoriesController < ProjectResourceController
2 3
  # Authorize
  before_filter :authorize_read_project!
4
  before_filter :authorize_code_access!
5 6 7
  before_filter :require_non_empty_project

  def show
8
    @activities = @repository.commits_with_refs(20)
9
  end
10 11

  def branches
12
    @branches = @repository.branches
13 14 15
  end

  def tags
16
    @tags = @repository.tags
17
  end
18

randx committed
19
  def stats
20
    @stats = Gitlab::GitStats.new(@repository.raw, @repository.root_ref)
randx committed
21 22 23
    @graph = @stats.graph
  end

24 25
  def archive
    unless can?(current_user, :download_code, @project)
randx committed
26
      render_404 and return
27 28 29
    end


30
    file_path = @repository.archive_repo(params[:ref])
31 32 33 34 35 36 37

    if file_path
      # Send file to user
      send_file file_path
    else
      render_404
    end
38
  end
39
end