diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 604407f5b..d4678b12d 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -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