@@ -14,6 +14,7 @@ import (
14
14
"code.gitea.io/gitea/modules/cache"
15
15
"code.gitea.io/gitea/modules/git"
16
16
"code.gitea.io/gitea/modules/log"
17
+ "code.gitea.io/gitea/modules/notification"
17
18
"code.gitea.io/gitea/modules/process"
18
19
"code.gitea.io/gitea/modules/setting"
19
20
"code.gitea.io/gitea/modules/sync"
@@ -336,19 +337,17 @@ func syncMirror(repoID string) {
336
337
continue
337
338
}
338
339
340
+ tp, _ := git.SplitRefName(result.refName)
341
+
339
342
// Create reference
340
343
if result.oldCommitID == gitShortEmptySha {
341
- if err = SyncCreateAction(m.Repo, result.refName); err != nil {
342
- log.Error("SyncCreateAction [repo_id: %d]: %v", m.RepoID, err)
343
- }
344
+ notification.NotifySyncCreateRef(m.Repo.MustOwner(), m.Repo, tp, result.refName)
344
345
continue
345
346
}
346
347
347
348
// Delete reference
348
349
if result.newCommitID == gitShortEmptySha {
349
- if err = SyncDeleteAction(m.Repo, result.refName); err != nil {
350
- log.Error("SyncDeleteAction [repo_id: %d]: %v", m.RepoID, err)
351
- }
350
+ notification.NotifySyncDeleteRef(m.Repo.MustOwner(), m.Repo, tp, result.refName)
352
351
continue
353
352
}
354
353
@@ -368,15 +367,15 @@ func syncMirror(repoID string) {
368
367
log.Error("CommitsBetweenIDs [repo_id: %d, new_commit_id: %s, old_commit_id: %s]: %v", m.RepoID, newCommitID, oldCommitID, err)
369
368
continue
370
369
}
371
- if err = SyncPushAction(m.Repo, SyncPushActionOptions{
372
- RefName: result.refName,
373
- OldCommitID: oldCommitID,
374
- NewCommitID: newCommitID,
375
- Commits: models.ListToPushCommits(commits),
376
- }); err != nil {
377
- log.Error("SyncPushAction [repo_id: %d]: %v", m.RepoID, err)
378
- continue
370
+
371
+ theCommits := models.ListToPushCommits(commits)
372
+ if len(theCommits.Commits) > setting.UI.FeedMaxCommitNum {
373
+ theCommits.Commits = theCommits.Commits[:setting.UI.FeedMaxCommitNum]
379
374
}
375
+
376
+ theCommits.CompareURL = m.Repo.ComposeCompareURL(oldCommitID, newCommitID)
377
+
378
+ notification.NotifySyncPushCommits(m.Repo.MustOwner(), m.Repo, result.refName, oldCommitID, newCommitID, models.ListToPushCommits(commits))
380
379
}
381
380
382
381
// Get latest commit date and update to current repository updated time
0 commit comments