repository: git: change io.gets to io.readlines (#5404, #5096).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4624 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-01-03 10:45:00 +00:00
parent 8487e0a5b8
commit 7958facadc
1 changed files with 8 additions and 8 deletions

View File

@ -89,12 +89,13 @@ module Redmine
cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --date=iso --pretty=fuller --no-merges -n 1 " cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --date=iso --pretty=fuller --no-merges -n 1 "
cmd << " #{shell_quote rev} " if rev cmd << " #{shell_quote rev} " if rev
cmd << "-- #{shell_quote path} " unless path.empty? cmd << "-- #{shell_quote path} " unless path.empty?
shellout(cmd) do |io| lines = []
begin shellout(cmd) { |io| lines = io.readlines }
id = io.gets.split[1] return nil if $? && $?.exitstatus != 0
author = io.gets.match('Author:\s+(.*)$')[1] begin
2.times { io.gets } id = lines[0].split[1]
time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime author = lines[1].match('Author:\s+(.*)$')[1]
time = Time.parse(lines[4].match('CommitDate:\s+(.*)$')[1]).localtime
Revision.new({ Revision.new({
:identifier => id, :identifier => id,
@ -104,10 +105,9 @@ module Redmine
:message => nil, :message => nil,
:paths => nil :paths => nil
}) })
rescue NoMethodError => e rescue NoMethodError => e
logger.error("The revision '#{path}' has a wrong format") logger.error("The revision '#{path}' has a wrong format")
return nil return nil
end
end end
end end