Skip to content

Commit 1bec46a

Browse files
committed
fix grep search
1 parent 7866959 commit 1bec46a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

routers/web/repo/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func Search(ctx *context.Context) {
7070
res, err := git.GrepSearch(ctx, ctx.Repo.GitRepo, prepareSearch.Keyword, git.GrepOptions{
7171
ContextLineNumber: 1,
7272
IsFuzzy: prepareSearch.IsFuzzy,
73-
RefName: git.RefNameFromBranch(ctx.Repo.BranchName).String(), // BranchName should be default branch or the first existing branch
73+
RefName: git.RefNameFromBranch(ctx.Repo.Repository.DefaultBranch).String(), // BranchName should be default branch or the first existing branch
7474
PathspecList: indexSettingToGitGrepPathspecList(),
7575
})
7676
if err != nil {

routers/web/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ func registerRoutes(m *web.Router) {
15921592
m.Get("/watchers", repo.Watchers)
15931593
m.Get("/search", reqUnitCodeReader, repo.Search)
15941594
m.Post("/action/{action}", reqSignIn, repo.Action)
1595-
}, optSignIn, context.RepoAssignment, context.RepoRef())
1595+
}, optSignIn, context.RepoAssignment)
15961596

15971597
common.AddOwnerRepoGitLFSRoutes(m, optSignInIgnoreCsrf, lfsServerEnabled) // "/{username}/{reponame}/{lfs-paths}": git-lfs support
15981598

0 commit comments

Comments
 (0)