]> source.dussan.org Git - redmine.git/commitdiff
scm: git: lib: return array of Branch class instead of array of strings at branches...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 28 Oct 2011 05:17:46 +0000 (05:17 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 28 Oct 2011 05:17:46 +0000 (05:17 +0000)
Contributed by Jan TopiƄski.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7671 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/git_adapter.rb

index f5dfbe2ae123e708c2d19bc22821414bd28fa178..c0f190ad7b81e0ff59e74c516d38b690ed31fc44 100644 (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!