##// END OF EJS Templates
Do not query git for tags and branches multiple times per request....
Jean-Philippe Lang -
r3353:4878d749f499
parent child
Show More
@@ -33,21 +33,22 module Redmine
33 end
33 end
34
34
35 def branches
35 def branches
36 branches = []
36 return @branches if @branches
37 @branches = []
37 cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
38 cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
38 shellout(cmd) do |io|
39 shellout(cmd) do |io|
39 io.each_line do |line|
40 io.each_line do |line|
40 branches << line.match('\s*\*?\s*(.*)$')[1]
41 @branches << line.match('\s*\*?\s*(.*)$')[1]
41 end
42 end
42 end
43 end
43 branches.sort!
44 @branches.sort!
44 end
45 end
45
46
46 def tags
47 def tags
47 tags = []
48 return @tags if @tags
48 cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
49 cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
49 shellout(cmd) do |io|
50 shellout(cmd) do |io|
50 io.readlines.sort!.map{|t| t.strip}
51 @tags = io.readlines.sort!.map{|t| t.strip}
51 end
52 end
52 end
53 end
53
54
General Comments 0
You need to be logged in to leave comments. Login now