scm: git: lib: return array of Branch class instead of array of strings at branches method (#5501)

Contributed by Jan Topiński.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7671 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-10-28 05:17:46 +00:00
parent 033214578f
commit cec6f5c3b0
1 changed files with 6 additions and 2 deletions

View File

@ -77,10 +77,14 @@ module Redmine
def branches
return @branches if @branches
@branches = []
cmd_args = %w|branch --no-color|
cmd_args = %w|branch --no-color --verbose --no-abbrev|
scm_cmd(*cmd_args) do |io|
io.each_line do |line|
@branches << line.match('\s*\*?\s*(.*)$')[1]
branch_rev = line.match('\s*\*?\s*(.*?)\s*([0-9a-f]{40}).*$')
bran = Branch.new(branch_rev[1])
bran.revision = branch_rev[2]
bran.scmid = branch_rev[2]
@branches << bran
end
end
@branches.sort!