From dd6e604f8ffbb413999e2c1ea21fd9cc04a5df65 Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Fri, 8 May 2020 22:40:51 +0100
Subject: [PATCH] Add NotifySyncPushCommits to indexer notifier (#11309)
 (#11338)

Thanks to @simon-on-gh for tracking down the issue.

Fix #11200

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
---
 modules/notification/indexer/indexer.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/notification/indexer/indexer.go b/modules/notification/indexer/indexer.go
index 70ad44483b..f1e6366d2f 100644
--- a/modules/notification/indexer/indexer.go
+++ b/modules/notification/indexer/indexer.go
@@ -124,6 +124,12 @@ func (r *indexerNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re
 	}
 }
 
+func (r *indexerNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *models.PushCommits) {
+	if setting.Indexer.RepoIndexerEnabled && refName == git.BranchPrefix+repo.DefaultBranch {
+		code_indexer.UpdateRepoIndexer(repo)
+	}
+}
+
 func (r *indexerNotifier) NotifyIssueChangeContent(doer *models.User, issue *models.Issue, oldContent string) {
 	issue_indexer.UpdateIssueIndexer(issue)
 }