@@ -208,7 +208,7 class RepositoriesController < ApplicationController | |||
|
208 | 208 | User.current.preference.save |
|
209 | 209 | end |
|
210 | 210 | @cache_key = "repositories/diff/#{@repository.id}/" + |
|
211 | Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") | |
|
211 | Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}") | |
|
212 | 212 | unless read_fragment(@cache_key) |
|
213 | 213 | @diff = @repository.diff(@path, @rev, @rev_to) |
|
214 | 214 | show_error_not_found unless @diff |
@@ -56,6 +56,8 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
56 | 56 | if @char_1.respond_to?(:force_encoding) |
|
57 | 57 | @char_1.force_encoding('UTF-8') |
|
58 | 58 | end |
|
59 | ||
|
60 | Setting.default_language = 'en' | |
|
59 | 61 | end |
|
60 | 62 | |
|
61 | 63 | if File.directory?(REPOSITORY_PATH) |
@@ -219,6 +221,27 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
219 | 221 | end |
|
220 | 222 | end |
|
221 | 223 | |
|
224 | def test_diff_truncated | |
|
225 | @repository.fetch_changesets | |
|
226 | @repository.reload | |
|
227 | Setting.diff_max_lines_displayed = 5 | |
|
228 | ||
|
229 | # Truncated diff of changeset 2f9c0091 | |
|
230 | with_cache do | |
|
231 | get :diff, :id => PRJ_ID, :type => 'inline', | |
|
232 | :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' | |
|
233 | assert_response :success | |
|
234 | assert @response.body.include?("... This diff was truncated") | |
|
235 | ||
|
236 | Setting.default_language = 'fr' | |
|
237 | get :diff, :id => PRJ_ID, :type => 'inline', | |
|
238 | :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' | |
|
239 | assert_response :success | |
|
240 | assert ! @response.body.include?("... This diff was truncated") | |
|
241 | assert @response.body.include?("... Ce diff") | |
|
242 | end | |
|
243 | end | |
|
244 | ||
|
222 | 245 | def test_diff_two_revs |
|
223 | 246 | @repository.fetch_changesets |
|
224 | 247 | @repository.reload |
@@ -361,4 +384,12 class RepositoriesGitControllerTest < ActionController::TestCase | |||
|
361 | 384 | puts "Git test repository NOT FOUND. Skipping functional tests !!!" |
|
362 | 385 | def test_fake; assert true end |
|
363 | 386 | end |
|
387 | ||
|
388 | private | |
|
389 | def with_cache(&block) | |
|
390 | before = ActionController::Base.perform_caching | |
|
391 | ActionController::Base.perform_caching = true | |
|
392 | block.call | |
|
393 | ActionController::Base.perform_caching = before | |
|
394 | end | |
|
364 | 395 | end |
General Comments 0
You need to be logged in to leave comments.
Login now