Commit 3c704c33 authored by Robert Schilling's avatar Robert Schilling

Delete tags via rugged

parent c795ef07
...@@ -67,6 +67,7 @@ v 8.7.0 (unreleased) ...@@ -67,6 +67,7 @@ v 8.7.0 (unreleased)
- Fix repository cache invalidation issue when project is recreated with an empty repo (Stan Hu) - Fix repository cache invalidation issue when project is recreated with an empty repo (Stan Hu)
- Fix: Allow empty recipients list for builds emails service when pushed is added (Frank Groeneveld) - Fix: Allow empty recipients list for builds emails service when pushed is added (Frank Groeneveld)
- Improved markdown forms - Improved markdown forms
- Delete tags using Rugged for performance reasons (Robert Schilling)
- Diffs load at the correct point when linking from from number - Diffs load at the correct point when linking from from number
- Selected diff rows highlight - Selected diff rows highlight
- Fix emoji catgories in the emoji picker - Fix emoji catgories in the emoji picker
......
...@@ -169,7 +169,12 @@ class Repository ...@@ -169,7 +169,12 @@ class Repository
def rm_tag(tag_name) def rm_tag(tag_name)
before_remove_tag before_remove_tag
gitlab_shell.rm_tag(path_with_namespace, tag_name) begin
rugged.tags.delete(tag_name)
true
rescue Rugged::ReferenceError
false
end
end end
def branch_names def branch_names
......
...@@ -137,19 +137,6 @@ module Gitlab ...@@ -137,19 +137,6 @@ module Gitlab
Gitlab::Utils.system_silent(cmd) Gitlab::Utils.system_silent(cmd)
end end
# Remove repository tag
#
# path - project path with namespace
# tag_name - tag name to remove
#
# Ex.
# rm_tag("gitlab/gitlab-ci", "v4.0")
#
def rm_tag(path, tag_name)
Gitlab::Utils.system_silent([gitlab_shell_projects_path, 'rm-tag',
"#{path}.git", tag_name])
end
# Gc repository # Gc repository
# #
# path - project path with namespace # path - project path with namespace
......
...@@ -770,11 +770,9 @@ describe Repository, models: true do ...@@ -770,11 +770,9 @@ describe Repository, models: true do
describe '#rm_tag' do describe '#rm_tag' do
it 'removes a tag' do it 'removes a tag' do
expect(repository).to receive(:before_remove_tag) expect(repository).to receive(:before_remove_tag)
expect(repository.rugged.tags).to receive(:delete).with('v1.1.0')
expect_any_instance_of(Gitlab::Shell).to receive(:rm_tag). repository.rm_tag('v1.1.0')
with(repository.path_with_namespace, '8.5')
repository.rm_tag('8.5')
end end
end end
......
...@@ -6,21 +6,12 @@ describe DeleteTagService, services: true do ...@@ -6,21 +6,12 @@ describe DeleteTagService, services: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:service) { described_class.new(project, user) } let(:service) { described_class.new(project, user) }
let(:tag) { double(:tag, name: '8.5', target: 'abc123') }
describe '#execute' do describe '#execute' do
before do
allow(repository).to receive(:find_tag).and_return(tag)
end
it 'removes the tag' do it 'removes the tag' do
expect_any_instance_of(Gitlab::Shell).to receive(:rm_tag).
and_return(true)
expect(repository).to receive(:before_remove_tag) expect(repository).to receive(:before_remove_tag)
expect(service).to receive(:success) expect(service).to receive(:success)
service.execute('8.5') service.execute('v1.1.0')
end end
end 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