Skip to content
Snippets Groups Projects
Commit c297aa44 authored by Alejandro Rodríguez's avatar Alejandro Rodríguez
Browse files

Revert to previous diff pruning behavior

Before 10.6.9, if a rugged diff met the conditions for being too-large
(which obiously meant it was also collapsable), too-large would take
precedence. This reverts the behavior back to that, since gitlab-ce
depends on this
parent 0cd94c0f
No related branches found
No related tags found
1 merge request!132Revert to previous diff pruning behavior
Pipeline #
v 10.6.10
- Ignore invalid encodings when parsing Git attribute files
- Revert to previous diff pruning behavior
 
v 10.6.9
- Optimize diff creation from Rugged::Patch
Loading
Loading
Loading
Loading
@@ -290,14 +290,14 @@ module Gitlab
prune_large_diff!
return true
end
if collapse && size >= DIFF_COLLAPSE_LIMIT
prune_collapsed_diff!
return true
end
end
end
 
if collapse && size >= DIFF_COLLAPSE_LIMIT
prune_collapsed_diff!
return true
end
false
end
 
Loading
Loading
Loading
Loading
@@ -80,6 +80,24 @@ EOT
end
end
 
context 'using a collapsable diff that is too large' do
before do
# The patch total size is 200, with lines between 21 and 54.
# This is a quick-and-dirty way to test this. Ideally, a new patch is
# added to the test repo with a size that falls between the real limits.
stub_const('Gitlab::Git::Diff::DIFF_SIZE_LIMIT', 150)
stub_const('Gitlab::Git::Diff::DIFF_COLLAPSE_LIMIT', 100)
end
it 'prunes the diff as a large diff instead of as a collapsed diff' do
diff = Gitlab::Git::Diff.new(@rugged_diff, collapse: true)
expect(diff.diff).to be_empty
expect(diff).to be_too_large
expect(diff).not_to be_collapsed
end
end
context 'using a large binary diff' do
it 'does not prune the diff' do
expect_any_instance_of(Rugged::Diff::Delta).to receive(:binary?).
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment