Skip to content

Commit 5549c1b

Browse files
authored
Merge branch 'main' into pagination-forks
2 parents c5e35cb + ab13797 commit 5549c1b

File tree

8 files changed

+13
-20
lines changed

8 files changed

+13
-20
lines changed

modules/indexer/code/bleve.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func NewBleveIndexer(indexDir string) (*BleveIndexer, bool, error) {
173173
indexDir: indexDir,
174174
}
175175
created, err := indexer.init()
176+
if err != nil {
177+
indexer.Close()
178+
return nil, false, err
179+
}
176180
return indexer, created, err
177181
}
178182

modules/indexer/code/elastic_search.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ func NewElasticSearchIndexer(url, indexerName string) (*ElasticSearchIndexer, bo
8282
indexerAliasName: indexerName,
8383
}
8484
exists, err := indexer.init()
85-
85+
if err != nil {
86+
indexer.Close()
87+
return nil, false, err
88+
}
8689
return indexer, !exists, err
8790
}
8891

modules/indexer/code/indexer.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ func Init() {
185185

186186
rIndexer, populate, err = NewBleveIndexer(setting.Indexer.RepoPath)
187187
if err != nil {
188-
if rIndexer != nil {
189-
rIndexer.Close()
190-
}
191188
cancel()
192189
indexer.Close()
193190
close(waitChannel)
@@ -205,9 +202,6 @@ func Init() {
205202

206203
rIndexer, populate, err = NewElasticSearchIndexer(setting.Indexer.RepoConnStr, setting.Indexer.RepoIndexerName)
207204
if err != nil {
208-
if rIndexer != nil {
209-
rIndexer.Close()
210-
}
211205
cancel()
212206
indexer.Close()
213207
close(waitChannel)

modules/repository/adopt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func ListUnadoptedRepositories(query string, opts *db.ListOptions) ([]string, in
154154
count := 0
155155

156156
// We're going to iterate by pagesize.
157-
root := filepath.Join(setting.RepoRootPath)
157+
root := filepath.Clean(setting.RepoRootPath)
158158
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
159159
if err != nil {
160160
return err

routers/web/base.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,6 @@ func Recovery() func(next http.Handler) http.Handler {
130130
log.Error("%v", combinedErr)
131131

132132
sessionStore := session.GetSession(req)
133-
if sessionStore == nil {
134-
if setting.IsProd {
135-
http.Error(w, http.StatusText(500), 500)
136-
} else {
137-
http.Error(w, combinedErr, 500)
138-
}
139-
return
140-
}
141133

142134
var lc = middleware.Locale(w, req)
143135
var store = dataStore{

routers/web/user/setting/adopt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func AdoptOrDeleteRepository(ctx *context.Context) {
2727
action := ctx.FormString("action")
2828

2929
ctxUser := ctx.User
30-
root := filepath.Join(models.UserPath(ctxUser.LowerName))
30+
root := models.UserPath(ctxUser.LowerName)
3131

3232
// check not a repo
3333
has, err := models.IsRepositoryExist(ctxUser, dir)

routers/web/user/setting/profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func Repos(ctx *context.Context) {
250250
repoNames := make([]string, 0, setting.UI.Admin.UserPagingNum)
251251
repos := map[string]*models.Repository{}
252252
// We're going to iterate by pagesize.
253-
root := filepath.Join(models.UserPath(ctxUser.Name))
253+
root := models.UserPath(ctxUser.Name)
254254
if err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
255255
if err != nil {
256256
if os.IsNotExist(err) {

services/pull/merge.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ func rawMerge(pr *models.PullRequest, doer *models.User, mergeStyle models.Merge
275275
filepath.Join(tmpBasePath, ".git", "rebase-merge", "stopped-sha"), // Git >= 2.26
276276
}
277277
for _, failingCommitPath := range failingCommitPaths {
278-
if _, statErr := os.Stat(filepath.Join(failingCommitPath)); statErr == nil {
279-
commitShaBytes, readErr := os.ReadFile(filepath.Join(failingCommitPath))
278+
if _, statErr := os.Stat(failingCommitPath); statErr == nil {
279+
commitShaBytes, readErr := os.ReadFile(failingCommitPath)
280280
if readErr != nil {
281281
// Abandon this attempt to handle the error
282282
log.Error("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s", pr.HeadRepo.FullName(), pr.HeadBranch, pr.BaseRepo.FullName(), pr.BaseBranch, err, outbuf.String(), errbuf.String())

0 commit comments

Comments
 (0)