Defect #6346
closedAge column on repository view is skewed for git, probably CVS too
100%
Description
Ok, this is a nasty one and it wasn't easy to find, but I think I figured it out.
The gist of the problem is that Redmine::Scm::Adapters::Entry#lastrev
returns a Redmine::Scm::Adapters::Revision
for which the #time
is with most adapters a Time
expressed in local time, with the git adapter a String
and with the CVS adapter a Time
, but I'm not sure in what timezone. The problem with this is that the view methods, specifically distance_of_time_in_words
(source:/trunk/app/views/repositories/_dir_list_content.rhtml#L21), will happily take either Time
or String
, but fails to parse the included timezone information, at least in the format the git adapter delivers.
In a console:
>> Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time.class => String >> Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time => "Fri Sep 3 17:34:00 2010 +0200" >> Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time.to_time => Fri Sep 03 17:34:00 UTC 2010 >> Time.parse(Project.find("redmine-doodles").repository.entry("init.rb").lastrev.time).localtime => Fri Sep 03 17:34:00 +0200 2010 >> Project.find("sandbox").repository.entry("tags").lastrev.time.class => Time >> Project.find("sandbox").repository.entry("tags").lastrev.time => Thu Dec 03 15:41:08 +0100 2009 >> Project.find("sandbox").repository.entry("tags").lastrev.time.to_time => Thu Dec 03 15:41:08 +0100 2009
redmine-doodles
has a git repo, sandbox
a svn repo, #to_time
is what distance_of_time_in_words
uses to cast whatever it's given to a Time
, which misses the time zone information (at least with String#to_time
).
Files