Project

General

Profile

RE: Git repository not fetched ยป git-io-gets.diff

Toshi MARUYAMA, 2010-11-23 07:06

View differences:

lib/redmine/scm/adapters/git_adapter.rb
89 89
          cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --date=iso --pretty=fuller --no-merges -n 1 "
90 90
          cmd << " #{shell_quote rev} " if rev 
91 91
          cmd <<  "-- #{shell_quote path} " unless path.empty?
92
          shellout(cmd) do |io|
93
            begin
94
              id = io.gets.split[1]
95
              author = io.gets.match('Author:\s+(.*)$')[1]
96
              2.times { io.gets }
97
              time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime
92
          lines = []
93
          shellout(cmd) { |io| lines = io.readlines }
94
          return nil if $? && $?.exitstatus != 0
95
          begin
96
              id = lines[0].split[1]
97
              author = lines[1].match('Author:\s+(.*)$')[1]
98
              time = Time.parse(lines[4].match('CommitDate:\s+(.*)$')[1]).localtime
98 99

  
99 100
              Revision.new({
100 101
                :identifier => id,
......
104 105
                :message => nil, 
105 106
                :paths => nil 
106 107
              })
107
            rescue NoMethodError => e
108
          rescue NoMethodError => e
108 109
              logger.error("The revision '#{path}' has a wrong format")
109 110
              return nil
110
            end
111 111
          end
112 112
        end
113 113

  
    (1-1/1)