Project

General

Profile

Feature #35432 » 0001-Code-cleanup-of-RepositoriesController-annotate.patch

Go MAEDA, 2023-04-23 09:03

View differences:

app/controllers/repositories_controller.rb
202 202
    (show_error_not_found; return) unless @entry
203 203

  
204 204
    @annotate = @repository.scm.annotate(@path, @rev)
205
    if @annotate.nil? || @annotate.empty?
205
    if @annotate.blank?
206 206
      @annotate = nil
207 207
      @error_message = l(:error_scm_annotate)
208
    else
209
      ann_buf_size = 0
210
      @annotate.lines.each do |buf|
211
        ann_buf_size += buf.size
212
      end
213
      if ann_buf_size > Setting.file_max_size_displayed.to_i.kilobyte
214
        @annotate = nil
215
        @error_message = l(:error_scm_annotate_big_text_file)
216
      end
208
    elsif @annotate.lines.sum(&:size) > Setting.file_max_size_displayed.to_i.kilobyte
209
      @annotate = nil
210
      @error_message = l(:error_scm_annotate_big_text_file)
217 211
    end
218 212
    @changeset = @repository.find_changeset_by_name(@rev)
219 213
  end
(5-5/8)