Delete tags via rugged
This commit is contained in:
parent
c795ef079c
commit
3c704c33e0
5 changed files with 10 additions and 28 deletions
|
@ -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: Allow empty recipients list for builds emails service when pushed is added (Frank Groeneveld)
|
||||
- Improved markdown forms
|
||||
- Delete tags using Rugged for performance reasons (Robert Schilling)
|
||||
- Diffs load at the correct point when linking from from number
|
||||
- Selected diff rows highlight
|
||||
- Fix emoji catgories in the emoji picker
|
||||
|
|
|
@ -169,7 +169,12 @@ class Repository
|
|||
def rm_tag(tag_name)
|
||||
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
|
||||
|
||||
def branch_names
|
||||
|
|
|
@ -137,19 +137,6 @@ module Gitlab
|
|||
Gitlab::Utils.system_silent(cmd)
|
||||
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
|
||||
#
|
||||
# path - project path with namespace
|
||||
|
|
|
@ -770,11 +770,9 @@ describe Repository, models: true do
|
|||
describe '#rm_tag' do
|
||||
it 'removes a tag' do
|
||||
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).
|
||||
with(repository.path_with_namespace, '8.5')
|
||||
|
||||
repository.rm_tag('8.5')
|
||||
repository.rm_tag('v1.1.0')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,21 +6,12 @@ describe DeleteTagService, services: true do
|
|||
let(:user) { create(:user) }
|
||||
let(:service) { described_class.new(project, user) }
|
||||
|
||||
let(:tag) { double(:tag, name: '8.5', target: 'abc123') }
|
||||
|
||||
describe '#execute' do
|
||||
before do
|
||||
allow(repository).to receive(:find_tag).and_return(tag)
|
||||
end
|
||||
|
||||
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(service).to receive(:success)
|
||||
|
||||
service.execute('8.5')
|
||||
service.execute('v1.1.0')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue