Skip to content

Commit 19df07f

Browse files
authored
Fix incorrect notification commit url (#21479) (#21483)
Backport #21479 For normal commits the notification url was wrong because oldCommitID is received from the shrinked commits list. This PR moves the commits list shrinking after the oldCommitID assignment.
1 parent 5a84558 commit 19df07f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

services/repository/push.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
220220
log.Error("updateIssuesCommit: %v", err)
221221
}
222222

223-
if len(commits.Commits) > setting.UI.FeedMaxCommitNum {
224-
commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum]
225-
}
226-
227223
oldCommitID := opts.OldCommitID
228224
if oldCommitID == git.EmptySHA && len(commits.Commits) > 0 {
229225
oldCommit, err := gitRepo.GetCommit(commits.Commits[len(commits.Commits)-1].Sha1)
@@ -251,6 +247,10 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
251247
commits.CompareURL = ""
252248
}
253249

250+
if len(commits.Commits) > setting.UI.FeedMaxCommitNum {
251+
commits.Commits = commits.Commits[:setting.UI.FeedMaxCommitNum]
252+
}
253+
254254
notification.NotifyPushCommits(pusher, repo, opts, commits)
255255

256256
if err = git_model.RemoveDeletedBranchByName(repo.ID, branch); err != nil {

0 commit comments

Comments
 (0)