summaryrefslogtreecommitdiff
path: root/app/services/git_operation_service.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-01-05 02:53:45 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-01-05 02:53:45 +0800
commite01c692a35d817c09416356b549f473f63d78dc8 (patch)
tree188eec336302d0aa314f19817ddd793df7a61950 /app/services/git_operation_service.rb
parent99ac0935271b1e99f4512e496104219045f1018e (diff)
downloadgitlab-ce-e01c692a35d817c09416356b549f473f63d78dc8.tar.gz
Remove tag with git hooks
Diffstat (limited to 'app/services/git_operation_service.rb')
-rw-r--r--app/services/git_operation_service.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/services/git_operation_service.rb b/app/services/git_operation_service.rb
index ed9822cfee6..3b7f702e3ab 100644
--- a/app/services/git_operation_service.rb
+++ b/app/services/git_operation_service.rb
@@ -15,7 +15,7 @@ class GitOperationService
def rm_branch(branch)
ref = Gitlab::Git::BRANCH_REF_PREFIX + branch.name
- oldrev = branch.dereferenced_target.id
+ oldrev = branch.target
newrev = Gitlab::Git::BLANK_SHA
update_ref_in_hooks(ref, newrev, oldrev)
@@ -36,6 +36,16 @@ class GitOperationService
end
end
+ def rm_tag(tag)
+ ref = Gitlab::Git::TAG_REF_PREFIX + tag.name
+ oldrev = tag.target
+ newrev = Gitlab::Git::BLANK_SHA
+
+ update_ref_in_hooks(ref, newrev, oldrev) do
+ repository.rugged.tags.delete(tag_name)
+ end
+ end
+
# Whenever `source_branch_name` is passed, if `branch_name` doesn't exist,
# it would be created from `source_branch_name`.
# If `source_project` is passed, and the branch doesn't exist,