diff options
Diffstat (limited to 'ruby/lib/gitlab/git/operation_service.rb')
-rw-r--r-- | ruby/lib/gitlab/git/operation_service.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ruby/lib/gitlab/git/operation_service.rb b/ruby/lib/gitlab/git/operation_service.rb index 8c62a13b7..5be4d27e0 100644 --- a/ruby/lib/gitlab/git/operation_service.rb +++ b/ruby/lib/gitlab/git/operation_service.rb @@ -40,19 +40,19 @@ module Gitlab update_ref_in_hooks(ref, newrev, oldrev) end - def add_tag(tag_name, newrev, options = {}) + def add_lightweight_tag(tag_name, tag_target) ref = Gitlab::Git::TAG_REF_PREFIX + tag_name oldrev = Gitlab::Git::BLANK_SHA - with_hooks(ref, newrev, oldrev) do |service| - # We want to pass the OID of the tag object to the hooks. For an - # annotated tag we don't know that OID until after the tag object - # (raw_tag) is created in the repository. That is why we have to - # update the value after creating the tag object. Only the - # "post-receive" hook will receive the correct value in this case. - raw_tag = repository.rugged.tags.create(tag_name, newrev, options) - service.newrev = raw_tag.target_id - end + update_ref_in_hooks(ref, tag_target, oldrev) + end + + def add_annotated_tag(tag_name, tag_target, options) + ref = Gitlab::Git::TAG_REF_PREFIX + tag_name + oldrev = Gitlab::Git::BLANK_SHA + annotation = repository.rugged.tags.create_annotation(tag_name, tag_target, options) + + update_ref_in_hooks(ref, annotation.oid, oldrev) end def rm_tag(tag) |