Skip to content

Commit 604117c

Browse files
authored
Merge branch 'master' into fix-go-gitea#6946-pass-in-pr-into-hooks
2 parents fefc60f + 54bd63c commit 604117c

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

custom/conf/app.ini.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ DEFAULT_MAX_BLOB_SIZE = 10485760
698698

699699
[oauth2]
700700
; Enables OAuth2 provider
701-
ENABLED = true
701+
ENABLE = true
702702
; Lifetime of an OAuth2 access token in seconds
703703
ACCESS_TOKEN_EXPIRATION_TIME=3600
704704
; Lifetime of an OAuth2 access token in hours

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
419419

420420
## OAuth2 (`oauth2`)
421421

422-
- `ENABLED`: **true**: Enables OAuth2 provider.
422+
- `ENABLE`: **true**: Enables OAuth2 provider.
423423
- `ACCESS_TOKEN_EXPIRATION_TIME`: **3600**: Lifetime of an OAuth2 access token in seconds
424424
- `REFRESH_TOKEN_EXPIRATION_TIME`: **730**: Lifetime of an OAuth2 access token in hours
425425
- `INVALIDATE_REFRESH_TOKEN`: **false**: Check if refresh token got already used

integrations/repo_search_test.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package integrations
66

77
import (
8-
"log"
98
"net/http"
109
"testing"
1110
"time"
@@ -34,22 +33,14 @@ func TestSearchRepo(t *testing.T) {
3433
repo, err := models.GetRepositoryByOwnerAndName("user2", "repo1")
3534
assert.NoError(t, err)
3635

37-
models.UpdateRepoIndexer(repo)
36+
waiter := make(chan error, 1)
37+
models.UpdateRepoIndexer(repo, waiter)
3838

39-
log.Printf("Waiting for indexing\n")
40-
41-
i := 0
42-
for i < 60 {
43-
if repo.IndexerStatus != nil && len(repo.IndexerStatus.CommitSha) != 0 {
44-
break
45-
}
46-
time.Sleep(1 * time.Second)
47-
i++
48-
}
49-
if i < 60 {
50-
log.Printf("Indexing took: %ds\n", i)
51-
} else {
52-
log.Printf("Waited the limit: %ds for indexing, continuing\n", i)
39+
select {
40+
case err := <-waiter:
41+
assert.NoError(t, err)
42+
case <-time.After(1 * time.Minute):
43+
assert.Fail(t, "UpdateRepoIndexer took too long")
5344
}
5445

5546
req := NewRequestf(t, "GET", "/user2/repo1/search?q=Description&page=1")

models/repo_indexer.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ func (repo *Repository) updateIndexerStatus(sha string) error {
5757
}
5858

5959
type repoIndexerOperation struct {
60-
repo *Repository
61-
deleted bool
60+
repo *Repository
61+
deleted bool
62+
watchers []chan<- error
6263
}
6364

6465
var repoIndexerOperationQueue chan repoIndexerOperation
@@ -312,26 +313,30 @@ func nonGenesisChanges(repo *Repository, revision string) (*repoChanges, error)
312313
func processRepoIndexerOperationQueue() {
313314
for {
314315
op := <-repoIndexerOperationQueue
316+
var err error
315317
if op.deleted {
316-
if err := indexer.DeleteRepoFromIndexer(op.repo.ID); err != nil {
318+
if err = indexer.DeleteRepoFromIndexer(op.repo.ID); err != nil {
317319
log.Error("DeleteRepoFromIndexer: %v", err)
318320
}
319321
} else {
320-
if err := updateRepoIndexer(op.repo); err != nil {
322+
if err = updateRepoIndexer(op.repo); err != nil {
321323
log.Error("updateRepoIndexer: %v", err)
322324
}
323325
}
326+
for _, watcher := range op.watchers {
327+
watcher <- err
328+
}
324329
}
325330
}
326331

327332
// DeleteRepoFromIndexer remove all of a repository's entries from the indexer
328-
func DeleteRepoFromIndexer(repo *Repository) {
329-
addOperationToQueue(repoIndexerOperation{repo: repo, deleted: true})
333+
func DeleteRepoFromIndexer(repo *Repository, watchers ...chan<- error) {
334+
addOperationToQueue(repoIndexerOperation{repo: repo, deleted: true, watchers: watchers})
330335
}
331336

332337
// UpdateRepoIndexer update a repository's entries in the indexer
333-
func UpdateRepoIndexer(repo *Repository) {
334-
addOperationToQueue(repoIndexerOperation{repo: repo, deleted: false})
338+
func UpdateRepoIndexer(repo *Repository, watchers ...chan<- error) {
339+
addOperationToQueue(repoIndexerOperation{repo: repo, deleted: false, watchers: watchers})
335340
}
336341

337342
func addOperationToQueue(op repoIndexerOperation) {

modules/git/tree_blob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (t *Tree) GetBlobByPath(relpath string) (*Blob, error) {
6060
return nil, err
6161
}
6262

63-
if !entry.IsDir() {
63+
if !entry.IsDir() && !entry.IsSubModule() {
6464
return entry.Blob(), nil
6565
}
6666

0 commit comments

Comments
 (0)