@@ -14,6 +14,7 @@ import (
1414 "code.gitea.io/gitea/modules/cache"
1515 "code.gitea.io/gitea/modules/git"
1616 "code.gitea.io/gitea/modules/log"
17+ "code.gitea.io/gitea/modules/notification"
1718 "code.gitea.io/gitea/modules/process"
1819 "code.gitea.io/gitea/modules/setting"
1920 "code.gitea.io/gitea/modules/sync"
@@ -336,19 +337,17 @@ func syncMirror(repoID string) {
336337 continue
337338 }
338339
340+ tp , _ := git .SplitRefName (result .refName )
341+
339342 // Create reference
340343 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 )
344345 continue
345346 }
346347
347348 // Delete reference
348349 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 )
352351 continue
353352 }
354353
@@ -368,15 +367,15 @@ func syncMirror(repoID string) {
368367 log .Error ("CommitsBetweenIDs [repo_id: %d, new_commit_id: %s, old_commit_id: %s]: %v" , m .RepoID , newCommitID , oldCommitID , err )
369368 continue
370369 }
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 ]
379374 }
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 ))
380379 }
381380
382381 // Get latest commit date and update to current repository updated time
0 commit comments