Skip to content

Commit 11ac14c

Browse files
authored
Fix incorrect notification commit url (#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 acdb92a commit 11ac14c

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
@@ -219,10 +219,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
219219
log.Error("updateIssuesCommit: %v", err)
220220
}
221221

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

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

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

0 commit comments

Comments
 (0)