aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo_indexer.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/repo_indexer.go')
-rw-r--r--models/repo_indexer.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/models/repo_indexer.go b/models/repo_indexer.go
index f625b80389..b842a1c87f 100644
--- a/models/repo_indexer.go
+++ b/models/repo_indexer.go
@@ -234,7 +234,21 @@ func addDelete(filename string, repo *Repository, batch rupture.FlushingBatch) e
}
func isIndexable(entry *git.TreeEntry) bool {
- return entry.IsRegular() || entry.IsExecutable()
+ if !entry.IsRegular() && !entry.IsExecutable() {
+ return false
+ }
+ name := strings.ToLower(entry.Name())
+ for _, g := range setting.Indexer.ExcludePatterns {
+ if g.Match(name) {
+ return false
+ }
+ }
+ for _, g := range setting.Indexer.IncludePatterns {
+ if g.Match(name) {
+ return true
+ }
+ }
+ return len(setting.Indexer.IncludePatterns) == 0
}
// parseGitLsTreeOutput parses the output of a `git ls-tree -r --full-name` command