rosa-build/app/controllers/git/trees_controller.rb

19 lines
678 B
Ruby
Raw Normal View History

2012-01-30 20:39:34 +00:00
# -*- encoding : utf-8 -*-
class Git::TreesController < Git::BaseController
def show
redirect_to project_path(@project) and return if params[:treeish] == @project.default_branch and params[:path].blank?
@path = params[:path]
@tree = @git_repository.tree(@treeish)
@branch = @project.branch(@treeish)
2011-04-04 12:28:33 +01:00
2011-04-07 14:20:21 +01:00
# @commit = @git_repository.commits(@treeish, 1).first
2011-04-04 14:49:08 +01:00
# Raises Grit::Git::GitTimeout
@commit = @branch.present? ? @branch.commit() : @git_repository.log(@treeish, @path, :max_count => 1).first
render :template => "git/trees/empty" and return unless @commit
@tree = @tree / @path if @path
render :template => "git/trees/show"
end
2012-01-30 20:39:34 +00:00
end