summaryrefslogtreecommitdiff
path: root/app/controllers/repositories_controller.rb
blob: 229cb36949b82f28d484376fa3c45e9ce2fd623b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class RepositoriesController < ProjectResourceController
  # 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::GitStats.new(@repository.raw, @repository.root_ref)
    @graph = @stats.graph
  end

  def archive
    unless can?(current_user, :download_code, @project)
      render_404 and return
    end


    file_path = @repository.archive_repo(params[:ref])

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