2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2012-05-02 10:18:07 +01:00
|
|
|
class Projects::Git::CommitsController < Projects::Git::BaseController
|
2011-03-10 12:39:24 +00:00
|
|
|
def index
|
2011-04-04 14:49:08 +01:00
|
|
|
if @path.present?
|
2012-07-17 09:02:56 +01:00
|
|
|
@commits = @project.repo.log(@treeish, @path)
|
2011-04-04 14:49:08 +01:00
|
|
|
else
|
2012-07-17 09:02:56 +01:00
|
|
|
@commits, @page, @last_page = @project.paginate_commits(@treeish, :page => params[:page])
|
2011-04-04 14:49:08 +01:00
|
|
|
end
|
2011-03-10 12:39:24 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
2012-07-17 09:02:56 +01:00
|
|
|
@commit = @project.repo.commit(params[:id])
|
2011-03-10 12:39:24 +00:00
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
2012-03-21 19:55:14 +00:00
|
|
|
format.diff { render :text => (@commit.diffs.map(&:diff).join("\n") rescue ''), :content_type => "text/plain" }
|
2011-11-01 18:12:41 +00:00
|
|
|
format.patch { render :text => (@commit.to_patch rescue ''), :content_type => "text/plain" }
|
2011-03-10 12:39:24 +00:00
|
|
|
end
|
|
|
|
end
|
2012-01-11 18:15:35 +00:00
|
|
|
end
|