diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-12-29 12:40:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 19:40:57 +0800 |
commit | 8fa97a25f0dccc4db94d344ce7af632f8fe358b0 (patch) | |
tree | 0fc19177c4acef19ee8cc2be6ee1df1e8099d544 /services/repository | |
parent | 72f9050689912f5910a08d593ebe53078fe85aa4 (diff) | |
download | gitea-8fa97a25f0dccc4db94d344ce7af632f8fe358b0.tar.gz gitea-8fa97a25f0dccc4db94d344ce7af632f8fe358b0.zip |
Set HeadCommit when creating tags. (#18116)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services/repository')
-rw-r--r-- | services/repository/push.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/services/repository/push.go b/services/repository/push.go index c8ac5b2894..fe3f32f839 100644 --- a/services/repository/push.go +++ b/services/repository/push.go @@ -121,13 +121,22 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error { delTags = append(delTags, tagName) notification.NotifyDeleteRef(pusher, repo, "tag", opts.RefFullName) } else { // is new tag + newCommit, err := gitRepo.GetCommit(opts.NewCommitID) + if err != nil { + return fmt.Errorf("gitRepo.GetCommit: %v", err) + } + + commits := repo_module.NewPushCommits() + commits.HeadCommit = repo_module.CommitToPushCommit(newCommit) + commits.CompareURL = repo.ComposeCompareURL(git.EmptySHA, opts.NewCommitID) + notification.NotifyPushCommits( pusher, repo, &repo_module.PushUpdateOptions{ RefFullName: git.TagPrefix + tagName, OldCommitID: git.EmptySHA, NewCommitID: opts.NewCommitID, - }, repo_module.NewPushCommits()) + }, commits) addTags = append(addTags, tagName) notification.NotifyCreateRef(pusher, repo, "tag", opts.RefFullName) |