Skip to content
Snippets Groups Projects
Commit 4ec035b4 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
@@ -138,7 +138,7 @@ class Repository
Loading
@@ -138,7 +138,7 @@ class Repository
end end
   
def add_tag(tag_name, ref, message = nil) 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) gitlab_shell.add_tag(path_with_namespace, tag_name, ref, message)
end end
Loading
@@ -334,6 +334,7 @@ class Repository
Loading
@@ -334,6 +334,7 @@ class Repository
# Runs code before pushing (= creating or removing) a tag. # Runs code before pushing (= creating or removing) a tag.
def before_push_tag def before_push_tag
expire_cache expire_cache
expire_tags_cache
expire_tag_count_cache expire_tag_count_cache
end end
   
Loading
Loading
Loading
@@ -649,6 +649,17 @@ describe Repository, models: true do
Loading
@@ -649,6 +649,17 @@ describe Repository, models: true do
end end
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 describe '#rm_branch' do
let(:user) { create(:user) } let(:user) { create(:user) }
   
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