Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
3c704c33
Commit
3c704c33
authored
8 years ago
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete tags via rugged
parent
c795ef07
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
28 deletions
+10
-28
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+6
-1
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+0
-13
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+2
-4
spec/services/delete_tag_service_spec.rb
spec/services/delete_tag_service_spec.rb
+1
-10
No files found.
CHANGELOG
View file @
3c704c33
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
app/models/repository.rb
View file @
3c704c33
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
lib/gitlab/backend/shell.rb
View file @
3c704c33
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
spec/models/repository_spec.rb
View file @
3c704c33
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
spec/services/delete_tag_service_spec.rb
View file @
3c704c33
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment