From c89ddae61bbc76ee76dfea8509970b3aebb84213 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 15 Jan 2025 13:10:51 +0800 Subject: [PATCH] fix grep search --- routers/web/repo/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go index c60301475f357..d589586dad6a8 100644 --- a/routers/web/repo/search.go +++ b/routers/web/repo/search.go @@ -70,7 +70,7 @@ func Search(ctx *context.Context) { res, err := git.GrepSearch(ctx, ctx.Repo.GitRepo, prepareSearch.Keyword, git.GrepOptions{ ContextLineNumber: 1, IsFuzzy: prepareSearch.IsFuzzy, - RefName: git.RefNameFromBranch(ctx.Repo.BranchName).String(), // BranchName should be default branch or the first existing branch + RefName: git.RefNameFromBranch(ctx.Repo.Repository.DefaultBranch).String(), // BranchName should be default branch or the first existing branch PathspecList: indexSettingToGitGrepPathspecList(), }) if err != nil {