From 8142408d3a95a97f305a12d3d1f9b1731211d0dd Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 4 Mar 2023 13:02:50 -0500 Subject: [PATCH] Fill head commit to in payload when notifying push commits for mirroring (#23215) (#23292) 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 126d2bf354..60699294c1 100644 --- a/services/mirror/mirror_pull.go +++ b/services/mirror/mirror_pull.go @@ -499,6 +499,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(ctx, m.Repo.MustOwner(ctx), m.Repo, &repo_module.PushUpdateOptions{