]> source.dussan.org Git - redmine.git/commitdiff
Merged r4187 from trunk.
authorEric Davis <edavis@littlestreamsoftware.com>
Sun, 26 Sep 2010 22:33:45 +0000 (22:33 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Sun, 26 Sep 2010 22:33:45 +0000 (22:33 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4205 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/git_adapter.rb
test/unit/lib/redmine/scm/adapters/git_adapter_test.rb

index 0857d90471651723b5935cf4be591bf8199cbdde..9a79bbb07df35b142559dfe421bcdb492d34a058 100644 (file)
@@ -86,7 +86,7 @@ module Redmine
 
         def lastrev(path,rev)
           return nil if path.nil?
-          cmd = "#{GIT_BIN} --git-dir #{target('')} log --pretty=fuller --no-merges -n 1 "
+          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|
@@ -94,7 +94,7 @@ module Redmine
               id = io.gets.split[1]
               author = io.gets.match('Author:\s+(.*)$')[1]
               2.times { io.gets }
-              time = io.gets.match('CommitDate:\s+(.*)$')[1]
+              time = Time.parse(io.gets.match('CommitDate:\s+(.*)$')[1]).localtime
 
               Revision.new({
                 :identifier => id,
index 6b716b9cd25e29d0407c985b5f5858f7b73ea6d6..f51d4a31f1be92a993e496d6ab5cd2b6fe1c02e1 100644 (file)
@@ -29,6 +29,14 @@ class GitAdapterTest < ActiveSupport::TestCase
       assert_equal "jsmith", annotate.revisions[4].author
     end
     
+    def test_last_rev
+      last_rev = @adapter.lastrev("README", "4f26664364207fa8b1af9f8722647ab2d4ac5d43")
+      assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.scmid
+      assert_equal "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8", last_rev.identifier
+      assert_equal "Adam Soltys <asoltys@gmail.com>", last_rev.author
+      assert_equal "2009-06-24 05:27:38".to_time, last_rev.time
+    end
+    
     def test_annotate_moved_file
       annotate = @adapter.annotate('renamed_test.txt')
       assert_kind_of Redmine::Scm::Adapters::Annotate, annotate