Call the right hooks in Repository#add_tag
This ensures Repository#add_tag calls Repository#before_push_tag instead of just 1 random cache expiration method.
This commit is contained in:
parent
6857b92fab
commit
4ec035b488
|
@ -138,7 +138,7 @@ class Repository
|
|||
end
|
||||
|
||||
def add_tag(tag_name, ref, message = nil)
|
||||
expire_tags_cache
|
||||
before_push_tag
|
||||
|
||||
gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
|
||||
end
|
||||
|
@ -334,6 +334,7 @@ class Repository
|
|||
# Runs code before pushing (= creating or removing) a tag.
|
||||
def before_push_tag
|
||||
expire_cache
|
||||
expire_tags_cache
|
||||
expire_tag_count_cache
|
||||
end
|
||||
|
||||
|
|
|
@ -649,6 +649,17 @@ describe Repository, models: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#add_tag' do
|
||||
it 'adds a tag' do
|
||||
expect(repository).to receive(:before_push_tag)
|
||||
|
||||
expect_any_instance_of(Gitlab::Shell).to receive(:add_tag).
|
||||
with(repository.path_with_namespace, '8.5', 'master', 'foo')
|
||||
|
||||
repository.add_tag('8.5', 'master', 'foo')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#rm_branch' do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue