Actions
Defect #5612
closedgit repository reporting the wrong age
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2010-05-28
Due date:
% Done:
100%
Estimated time:
Resolution:
Duplicate
Affected version:
Description
Here is a patch to fix a problem where browsing a git repository reports the wrong age.
*** lib/redmine/scm/adapters/git_adapter.rb.orig Sun Feb 7 04:55:35 2010 --- lib/redmine/scm/adapters/git_adapter.rb Mon Mar 1 18:18:27 2010 *************** *** 85,91 **** def lastrev(path,rev) return nil if path.nil? ! cmd = "#{GIT_BIN} --git-dir #{target('')} log --pretty=fuller --no-merges -n 1 " cmd << " #{shell_quote rev} " if rev cmd << "-- #{path} " unless path.empty? shellout(cmd) do |io| --- 85,91 ---- def lastrev(path,rev) return nil if path.nil? ! cmd = "#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller --no-merges -n 1 " cmd << " #{shell_quote rev} " if rev cmd << "-- #{path} " unless path.empty? shellout(cmd) do |io| *************** *** 93,99 **** id = io.gets.split[1] author = io.gets.match('Author:\s+(.*)$')[1] 2.times { io.gets } ! time = io.gets.match('CommitDate:\s+(.*)$')[1] Revision.new({ :identifier => id, --- 93,99 ---- id = io.gets.split[1] author = io.gets.match('Author:\s+(.*)$')[1] 2.times { io.gets } ! time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]) Revision.new({ :identifier => id,
Updated by P H almost 15 years ago
I recall I found this patch from #4115 which was against 0.8.4 and applied it to 0.9.3
Worked for me, and perhaps will fix #5151 too?
It seems a safer way to do it... force git to output in a standard format and then get Ruby to parse.
Looking at it again I think the --date=iso is not needed but I would recommend it to protect against changes in default settings.
Without the --date=iso git prints- CommitDate: Tue May 25 15:46:39 2010 -0700
- CommitDate: 2010-05-25 15:46:39 -0700
The ruby script
#!/usr/bin/env ruby require "time" print "Time.parse(\"Tue May 25 15:46:39 2010 -0700\") = " puts Time.parse("Tue May 25 15:46:39 2010 -0700") print "Time.parse(\"2010-05-25 15:46:39 -0700\") = " puts Time.parse("2010-05-25 15:46:39 -0700")
produces...
Time.parse("Tue May 25 15:46:39 2010 -0700") = Tue May 25 15:46:39 -0700 2010 Time.parse("2010-05-25 15:46:39 -0700") = Tue May 25 15:46:39 -0700 2010
Updated by Toshi MARUYAMA over 14 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Updated by Felix Schäfer over 14 years ago
- Resolution set to Duplicate
This should be fixed, please open a new issue if this problem still persists.
Updated by Toshi MARUYAMA over 14 years ago
- Category set to SCM
- Status changed from Resolved to Closed
Actions