Commit 4ec035b4 authored by Yorick Peterse's avatar Yorick Peterse

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.
parent 6857b92f
......@@ -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) }
......
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