Do not query git for tags and branches multiple times per request.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3467 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
46aa855572
commit
4878d749f4
|
@ -33,21 +33,22 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
def branches
|
def branches
|
||||||
branches = []
|
return @branches if @branches
|
||||||
|
@branches = []
|
||||||
cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
|
cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
io.each_line do |line|
|
io.each_line do |line|
|
||||||
branches << line.match('\s*\*?\s*(.*)$')[1]
|
@branches << line.match('\s*\*?\s*(.*)$')[1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
branches.sort!
|
@branches.sort!
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags
|
def tags
|
||||||
tags = []
|
return @tags if @tags
|
||||||
cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
|
cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
|
||||||
shellout(cmd) do |io|
|
shellout(cmd) do |io|
|
||||||
io.readlines.sort!.map{|t| t.strip}
|
@tags = io.readlines.sort!.map{|t| t.strip}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue