forked from forgejo/forgejo
[PORT] Fix wrong line number in code search result (gitea#29260) (#2619)
Port [Fix wrong line number in code search result (gitea#29260)](https://github.com/go-gitea/gitea/pull/29260) PS: also added [`-e`](https://git-scm.com/docs/git-grep#Documentation/git-grep.txt--e) before passing the keyword (my bad) Co-authored-by: yp05327 <576951401@qq.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2619 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com> Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
This commit is contained in:
parent
79f8339c74
commit
3b2f28ff1c
6 changed files with 90 additions and 67 deletions
|
@ -25,14 +25,16 @@ func TestNewRepoGrep(t *testing.T) {
|
|||
|
||||
expected := []*Result{
|
||||
{
|
||||
RepoID: 0,
|
||||
Filename: "README.md",
|
||||
CommitID: "master",
|
||||
UpdatedUnix: 0,
|
||||
Language: "Markdown",
|
||||
Color: "#083fa1",
|
||||
LineNumbers: []int64{2, 3},
|
||||
FormattedLines: "\nDescription for repo1",
|
||||
RepoID: 0,
|
||||
Filename: "README.md",
|
||||
CommitID: "master",
|
||||
UpdatedUnix: 0,
|
||||
Language: "Markdown",
|
||||
Color: "#083fa1",
|
||||
Lines: []ResultLine{
|
||||
{Num: 2, FormattedContent: ""},
|
||||
{Num: 3, FormattedContent: "Description for repo1"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue