259-optimize.diff

John Goerzen, 2008-03-07 23:03

Download (1.59 KB)

View differences:

lib/redmine/scm/adapters/git_adapter.rb
36 36
            files=[]
37 37
            changeset = {}
38 38
            parsing_descr = 0  #0: not parsing desc or files, 1: parsing desc, 2: parsing files
39
            line_feeds = 0
40 39

  
41 40
            io.each_line do |line|
42 41
              if line =~ /^commit ([0-9a-f]{40})$/
......
97 96
        def info
98 97
          root_url = target('')
99 98
          info = Info.new({:root_url => target(''),
100
                            :lastrev => revisions(root_url,nil,nil,nil).first
99
                            :lastrev => revisions(root_url,nil,nil,{:limit => 1}).first
101 100
                          })
102 101
          info
103 102
        rescue Errno::ENOENT => e
......
142 141
        def revisions(path, identifier_from, identifier_to, options={})
143 142
          revisions = Revisions.new
144 143
          cmd = "cd #{target('')} && #{GIT_BIN} log --raw "
144
          cmd << " -n #{options[:limit].to_i}" if (!options.nil?) && options[:limit]
145 145
          cmd << " #{identifier_from}.. " if identifier_from
146 146
          cmd << " #{identifier_to} " if identifier_to
147 147
          #cmd << " HEAD " if !identifier_to
......
149 149
            files=[]
150 150
            changeset = {}
151 151
            parsing_descr = 0  #0: not parsing desc or files, 1: parsing desc, 2: parsing files
152
            line_feeds = 0
153 152
            revno = 1
154 153

  
155 154
            io.each_line do |line|