##// 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 33 end
34 34
35 35 def branches
36 branches = []
36 return @branches if @branches
37 @branches = []
37 38 cmd = "#{GIT_BIN} --git-dir #{target('')} branch"
38 39 shellout(cmd) do |io|
39 40 io.each_line do |line|
40 branches << line.match('\s*\*?\s*(.*)$')[1]
41 @branches << line.match('\s*\*?\s*(.*)$')[1]
41 42 end
42 43 end
43 branches.sort!
44 @branches.sort!
44 45 end
45 46
46 47 def tags
47 tags = []
48 return @tags if @tags
48 49 cmd = "#{GIT_BIN} --git-dir #{target('')} tag"
49 50 shellout(cmd) do |io|
50 io.readlines.sort!.map{|t| t.strip}
51 @tags = io.readlines.sort!.map{|t| t.strip}
51 52 end
52 53 end
53 54
General Comments 0
You need to be logged in to leave comments. Login now