MCPcopy Index your code
hub / github.com/gogs/gogs / SearchCommits

Function SearchCommits

internal/route/repo/commit.go:81–104  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

79}
80
81func SearchCommits(c *context.Context) {
82 c.Data["PageIsCommits"] = true
83
84 keyword := c.Query("q")
85 if keyword == "" {
86 c.Redirect(c.Repo.RepoLink + "/commits/" + c.Repo.BranchName)
87 return
88 }
89
90 commits, err := c.Repo.Commit.SearchCommits(keyword)
91 if err != nil {
92 c.Error(err, "search commits")
93 return
94 }
95
96 commits = RenderIssueLinks(commits, c.Repo.RepoLink)
97 c.Data["Commits"] = matchUsersWithCommitEmails(c.Req.Context(), commits)
98
99 c.Data["Keyword"] = keyword
100 c.Data["Username"] = c.Repo.Owner.Name
101 c.Data["Reponame"] = c.Repo.Repository.Name
102 c.Data["Branch"] = c.Repo.BranchName
103 c.Success(COMMITS)
104}
105
106func FileHistory(c *context.Context) {
107 renderCommits(c, c.Repo.TreePath)

Callers 1

RefCommitsFunction · 0.85

Calls 5

RenderIssueLinksFunction · 0.85
RedirectMethod · 0.80
SuccessMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected