diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-18 15:49:07 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-18 15:49:07 +0000 |
commit | c55733bc5058b793389101cce47b9b5807d73fd0 (patch) | |
tree | 6b720c847f38edb3545da5c4123d754cefad389b /app | |
parent | 50b95f31396e37900e4f3176a746bb668e10745c (diff) | |
parent | ae51774bc45d2e15ccc61b01a30d1b588f179f85 (diff) | |
download | gitlab-ce-c55733bc5058b793389101cce47b9b5807d73fd0.tar.gz |
Merge branch 'pass-correct-tag-target-to-post-receive' into 'master'
Pass correct tag target to post-receive hook when creating tag via UI
Fixes #24437
See merge request !7556
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 146424d2b1c..31be06be50c 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -176,11 +176,18 @@ class Repository options = { message: message, tagger: user_to_committer(user) } if message - GitHooksService.new.execute(user, path_to_repo, oldrev, target, ref) do - rugged.tags.create(tag_name, target, options) + rugged.tags.create(tag_name, target, options) + tag = find_tag(tag_name) + + GitHooksService.new.execute(user, path_to_repo, oldrev, tag.target, ref) do + # we already created a tag, because we need tag SHA to pass correct + # values to hooks end - find_tag(tag_name) + tag + rescue GitHooksService::PreReceiveError + rugged.tags.delete(tag_name) + raise end def rm_branch(user, branch_name) |