diff --git a/modules/git/grep.go b/modules/git/grep.go index ba870e054..bf65e86b8 100644 --- a/modules/git/grep.go +++ b/modules/git/grep.go @@ -67,9 +67,8 @@ func GrepSearch(ctx context.Context, repo *Repository, search string, opts GrepO "--null", "--break", "--heading", "--column", "--fixed-strings", "--line-number", "--ignore-case", "--full-name") cmd.AddOptionValues("--context", fmt.Sprint(opts.ContextLineNumber)) - if opts.MatchesPerFile > 0 { - cmd.AddOptionValues("--max-count", fmt.Sprint(opts.MatchesPerFile)) - } + opts.MatchesPerFile = cmp.Or(opts.MatchesPerFile, 20) + cmd.AddOptionValues("--max-count", fmt.Sprint(opts.MatchesPerFile)) words := []string{search} if opts.IsFuzzy { words = strings.Fields(search)