Commit 0586ea1c authored by Douwe Maan's avatar Douwe Maan

Merge branch 'sh-delta-check-with-annotated-tags' into 'master'

Fix EE delta size check handling with annotated tags

Closes #3589

See merge request gitlab-org/gitlab-ee!3041
parents 13d69e8b a1ce6618
---
title: Fix EE delta size check handling with annotated tags
merge_request:
author:
type: fixed
......@@ -7,6 +7,9 @@ module EE
begin
tree_a = repo.lookup(change[:oldrev])
tree_b = repo.lookup(change[:newrev])
return size_of_deltas unless diffable?(tree_a) && diffable?(tree_b)
diff = tree_a.diff(tree_b)
diff.each_delta do |d|
......@@ -25,6 +28,10 @@ module EE
size_of_deltas
end
end
def self.diffable?(object)
[Rugged::Commit, Rugged::Tree].include?(object.class)
end
end
end
end
......@@ -12,5 +12,19 @@ describe EE::Gitlab::Deltas do
expect(described_class.delta_size_check(change, project.repository)).to be > 0
end
it 'handles annotated tags on an object' do
object_id = 'faaf198af3a36dbf41961466703cc1d47c61d051'
options = { message: 'test tag message\n',
tagger: { name: 'John Smith', email: 'john@gmail.com' } }
result = project.repository.rugged.tags.create('annotated-tag', object_id, options)
change = {
oldrev: result.annotation.oid,
newrev: TestEnv::BRANCH_SHA['master']
}
expect(described_class.delta_size_check(change, project.repository)).to eq(0)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment