6346-new.diff

Toshi MARUYAMA, 2010-09-17 17:23

Download (1.65 KB)

View differences:

lib/redmine/scm/adapters/git_adapter.rb 土 9月 18 00:22:16 2010 +0900
86 86

  
87 87
        def lastrev(path,rev)
88 88
          return nil if path.nil?
89
          cmd = "#{GIT_BIN} --git-dir #{target('')} log --pretty=fuller --no-merges -n 1 "
89
          cmd = "#{GIT_BIN} --git-dir #{target('')} log --date=iso --pretty=fuller --no-merges -n 1 "
90 90
          cmd << " #{shell_quote rev} " if rev 
91 91
          cmd <<  "-- #{path} " unless path.empty?
92 92
          shellout(cmd) do |io|
......
94 94
              id = io.gets.split[1]
95 95
              author = io.gets.match('Author:\s+(.*)$')[1]
96 96
              2.times { io.gets }
97
              time = io.gets.match('CommitDate:\s+(.*)$')[1]
97
              strtime = io.gets.match('CommitDate:\s+(.*)$')[1]
98
              time = Time.parse(strtime)
98 99

  
99 100
              Revision.new({
100 101
                :identifier => id,
test/unit/repository_git_test.rb 土 9月 18 00:22:16 2010 +0900
50 50
      change = commit.changes.sort_by(&:path).first
51 51
      assert_equal "README", change.path
52 52
      assert_equal "A", change.action
53

  
54
      last_rev = @repository.scm.lastrev("README","7234cb2750b63f47bff735edc50a1c0a433c2518")
55
      assert_equal "2007-12-14 09:22:52".to_time, last_rev.time
56

  
53 57
    end
54 58
    
55 59
    def test_fetch_changesets_incremental