From b6eea680ce3516b8cc63a8c15356b9725f78e198 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sun, 5 Mar 2023 05:06:44 -0500 Subject: [PATCH] Fill head commit to in payload when notifying push commits for mirroring (#23215) (#23291) Backport #23215 Just like what has been done when pushing manually: https://github.com/go-gitea/gitea/blob/7a5af25592003ddc3017fcd7b822a3e02fc40ef6/services/repository/push.go#L225-L226 Before: image After: image Co-authored-by: Jason Song Co-authored-by: delvh Co-authored-by: Lunny Xiao --- services/mirror/mirror_pull.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/mirror/mirror_pull.go b/services/mirror/mirror_pull.go index ac9c9cc76d4b..8d16e34dad88 100644 --- a/services/mirror/mirror_pull.go +++ b/services/mirror/mirror_pull.go @@ -500,6 +500,13 @@ func SyncPullMirror(ctx context.Context, repoID int64) bool { theCommits.Commits = theCommits.Commits[:setting.UI.FeedMaxCommitNum] } + if newCommit, err := gitRepo.GetCommit(newCommitID); err != nil { + log.Error("SyncMirrors [repo: %-v]: unable to get commit %s: %v", m.Repo, newCommitID, err) + continue + } else { + theCommits.HeadCommit = repo_module.CommitToPushCommit(newCommit) + } + theCommits.CompareURL = m.Repo.ComposeCompareURL(oldCommitID, newCommitID) notification.NotifySyncPushCommits(m.Repo.MustOwner(), m.Repo, &repo_module.PushUpdateOptions{