Commit 4878d749 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

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
parent 46aa8555
......@@ -33,21 +33,22 @@ module Redmine
end
def branches
branches = []
return @branches if @branches
@branches = []
cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
shellout(cmd) do |io|
io.each_line do |line|
branches << line.match('\s*\*?\s*(.*)$')[1]
@branches << line.match('\s*\*?\s*(.*)$')[1]
end
end
branches.sort!
@branches.sort!
end
def tags
tags = []
return @tags if @tags
cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
shellout(cmd) do |io|
io.readlines.sort!.map{|t| t.strip}
@tags = io.readlines.sort!.map{|t| t.strip}
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment