forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Indexed search of repository contents (for default branch only)
- Loading branch information
1 parent
762f1d7
commit 5866eb2
Showing
33 changed files
with
1,214 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2017 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package integrations | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/PuerkitoBio/goquery" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func resultFilenames(t testing.TB, doc *HTMLDoc) []string { | ||
resultsSelection := doc.doc.Find(".repository.search") | ||
assert.EqualValues(t, 1, resultsSelection.Length(), | ||
"Invalid template (repo search template has changed?)") | ||
filenameSelections := resultsSelection.Find(".repo-search-result").Find(".header").Find("span.file") | ||
result := make([]string, filenameSelections.Length()) | ||
filenameSelections.Each(func(i int, selection *goquery.Selection) { | ||
result[i] = selection.Text() | ||
}) | ||
return result | ||
} | ||
|
||
func TestSearchRepo(t *testing.T) { | ||
prepareTestEnv(t) | ||
|
||
req := NewRequestf(t, "GET", "/user2/repo1/search?q=Description&page=1") | ||
resp := MakeRequest(t, req, http.StatusOK) | ||
|
||
filenames := resultFilenames(t, NewHTMLParser(t, resp.Body)) | ||
assert.EqualValues(t, []string{"README.md"}, filenames) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[] # empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2017 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package migrations | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/go-xorm/xorm" | ||
) | ||
|
||
func addRepoIndexerStatus(x *xorm.Engine) error { | ||
// RepoIndexerStatus see models/repo_indexer.go | ||
type RepoIndexerStatus struct { | ||
ID int64 `xorm:"pk autoincr"` | ||
RepoID int64 `xorm:"INDEX NOT NULL"` | ||
CommitSha string `xorm:"VARCHAR(40)"` | ||
} | ||
|
||
if err := x.Sync2(new(RepoIndexerStatus)); err != nil { | ||
return fmt.Errorf("Sync2: %v", err) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.