Tells git to output dates in ISO format.

Fixes: Git Adapter date parsing ignores timezone (#2149).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1995 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-11-08 15:50:51 +00:00
parent 47475acdaf
commit 9352bb527b
1 changed files with 4 additions and 4 deletions

View File

@ -23,16 +23,16 @@ module Redmine
class GitAdapter < AbstractAdapter class GitAdapter < AbstractAdapter
# Git executable name # Git executable name
GIT_BIN = "git" GIT_BIN = "D:\\dev\\git\\bin\\git.exe"
# Get the revision of a particuliar file # Get the revision of a particuliar file
def get_rev (rev,path) def get_rev (rev,path)
if rev != 'latest' && !rev.nil? if rev != 'latest' && !rev.nil?
cmd="#{GIT_BIN} --git-dir #{target('')} show #{shell_quote rev} -- #{shell_quote path}" cmd="#{GIT_BIN} --git-dir #{target('')} show --date=iso #{shell_quote rev} -- #{shell_quote path}"
else else
branch = shellout("#{GIT_BIN} --git-dir #{target('')} branch") { |io| io.grep(/\*/)[0].strip.match(/\* (.*)/)[1] } branch = shellout("#{GIT_BIN} --git-dir #{target('')} branch") { |io| io.grep(/\*/)[0].strip.match(/\* (.*)/)[1] }
cmd="#{GIT_BIN} --git-dir #{target('')} log -1 #{branch} -- #{shell_quote path}" cmd="#{GIT_BIN} --git-dir #{target('')} log --date=iso -1 #{branch} -- #{shell_quote path}"
end end
rev=[] rev=[]
i=0 i=0
@ -138,7 +138,7 @@ module Redmine
def revisions(path, identifier_from, identifier_to, options={}) def revisions(path, identifier_from, identifier_to, options={})
revisions = Revisions.new revisions = Revisions.new
cmd = "#{GIT_BIN} --git-dir #{target('')} log --raw " cmd = "#{GIT_BIN} --git-dir #{target('')} log --raw --date=iso"
cmd << " --reverse" if options[:reverse] cmd << " --reverse" if options[:reverse]
cmd << " -n #{options[:limit].to_i} " if (!options.nil?) && options[:limit] cmd << " -n #{options[:limit].to_i} " if (!options.nil?) && options[:limit]
cmd << " #{shell_quote(identifier_from + '..')} " if identifier_from cmd << " #{shell_quote(identifier_from + '..')} " if identifier_from