summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorCirno the Strongest <1447794+CirnoT@users.noreply.github.com>2020-12-16 13:41:21 +0100
committerGitHub <noreply@github.com>2020-12-16 14:41:21 +0200
commit66379ba7aed3d00633608b265617aab31de16979 (patch)
tree8b0c997a17817b97dcb9c83b238163d993769432 /services
parente7a77d32cc96692f5dbbd3ed1cfa7ff4a9ba026b (diff)
downloadgitea-66379ba7aed3d00633608b265617aab31de16979.tar.gz
gitea-66379ba7aed3d00633608b265617aab31de16979.zip
Send push event when tag is created or deleted (#13999)
Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services')
-rw-r--r--services/repository/push.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/services/repository/push.go b/services/repository/push.go
index 4ac37c9703..bed5c575fe 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -96,7 +96,7 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
return fmt.Errorf("Old and new revisions are both %s", git.EmptySHA)
}
var commits = &repo_module.PushCommits{}
- if opts.IsTag() { // If is tag reference {
+ if opts.IsTag() { // If is tag reference
if pusher == nil || pusher.ID != opts.PusherID {
var err error
if pusher, err = models.GetUserByID(opts.PusherID); err != nil {
@@ -105,9 +105,25 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
}
tagName := opts.TagName()
if opts.IsDelRef() {
+ notification.NotifyPushCommits(
+ pusher, repo,
+ &repo_module.PushUpdateOptions{
+ RefFullName: git.TagPrefix + tagName,
+ OldCommitID: opts.OldCommitID,
+ NewCommitID: git.EmptySHA,
+ }, repo_module.NewPushCommits())
+
delTags = append(delTags, tagName)
notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName)
} else { // is new tag
+ notification.NotifyPushCommits(
+ pusher, repo,
+ &repo_module.PushUpdateOptions{
+ RefFullName: git.TagPrefix + tagName,
+ OldCommitID: git.EmptySHA,
+ NewCommitID: opts.NewCommitID,
+ }, repo_module.NewPushCommits())
+
addTags = append(addTags, tagName)
notification.NotifyCreateRef(pusher, repo, "tag", opts.RefFullName)
}