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-10-12 20:59:14 +01:00
|
|
|
@commit = @commentable = @project.repo.commit(params[:id]) || raise(ActiveRecord::RecordNotFound)
|
2012-10-26 15:03:46 +01:00
|
|
|
@comments = Comment.for_commit(@commit)
|
2012-10-04 19:40:12 +01:00
|
|
|
|
2011-03-10 12:39:24 +00:00
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
2012-10-26 15:03:46 +01: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
|