Performance optimization: support limit for call to revisions

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@1210 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
John Goerzen committed 2008-03-08 19:48:17 +00:00
1 parent b36aa125a6
commit 12c5881ef0
1 file changed
+2 -1
+2 -1
View File
@@ -96,7 +96,7 @@ module Redmine
def info def info
root_url = target('') root_url = target('')
info = Info.new({:root_url => target(''), info = Info.new({:root_url => target(''),
:lastrev => revisions(root_url,nil,nil,nil).first :lastrev => revisions(root_url,nil,nil,{:limit => 1}).first
}) })
info info
rescue Errno::ENOENT => e rescue Errno::ENOENT => e
@@ -141,6 +141,7 @@ module Redmine
def revisions(path, identifier_from, identifier_to, options={}) def revisions(path, identifier_from, identifier_to, options={})
revisions = Revisions.new revisions = Revisions.new
cmd = "cd #{target('')} && #{GIT_BIN} log --raw " cmd = "cd #{target('')} && #{GIT_BIN} log --raw "
cmd << " -n #{options[:limit].to_i}" if (!options.nil?) && options[:limit]
cmd << " #{identifier_from}.. " if identifier_from cmd << " #{identifier_from}.. " if identifier_from
cmd << " #{identifier_to} " if identifier_to cmd << " #{identifier_to} " if identifier_to
#cmd << " HEAD " if !identifier_to #cmd << " HEAD " if !identifier_to