2011-03-10 12:39:24 +00:00
|
|
|
class Git::CommitsController < Git::BaseController
|
|
|
|
|
|
|
|
def index
|
|
|
|
@branch_name = (params[:branch] ? params[:branch] : "master")
|
|
|
|
@path = params[:path]
|
|
|
|
|
2011-04-04 14:49:08 +01:00
|
|
|
if @path.present?
|
|
|
|
@commits = @git_repository.repo.log(@branch_name, @path)
|
|
|
|
@render_paginate = false
|
|
|
|
else
|
|
|
|
@commits, @page, @last_page = @git_repository.paginate_commits(@branch_name, :page => params[:page])
|
|
|
|
@render_paginate = true
|
|
|
|
end
|
2011-03-10 12:39:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2011-03-11 17:19:47 +00:00
|
|
|
@commit = @git_repository.commits(params[:id]).first
|
2011-03-10 12:39:24 +00:00
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
|
|
|
format.diff { render :text => @commit.diffs.map{|d| d.diff}.join("\n"), :content_type => "text/plain" }
|
|
|
|
format.patch { render :text => @commit.to_patch, :content_type => "text/plain" }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|