Merge master into indexbyfileext

This commit is contained in:
Guillermo Prandi 2019-08-06 21:28:35 -03:00
commit 021014acfe
4 changed files with 23 additions and 3 deletions

View File

@ -238,6 +238,8 @@ var migrations = []Migration{
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
// v91 -> v92
NewMigration("add index on owner_id of repository and type, review_id of comment", addIndexOnRepositoryAndComment),
// v92 -> v93
NewMigration("remove orphaned repository index statuses", removeLingeringIndexStatus),
}
// Migrate database to current version

16
models/migrations/v92.go Normal file
View File

@ -0,0 +1,16 @@
// Copyright 2019 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 (
"github.com/go-xorm/xorm"
"xorm.io/builder"
)
func removeLingeringIndexStatus(x *xorm.Engine) error {
_, err := x.Exec(builder.Delete(builder.NotIn("`repo_id`", builder.Select("`id`").From("`repository`"))).From("`repo_indexer_status`"))
return err
}

View File

@ -685,12 +685,14 @@ func rewriteAllPublicKeys(e Engine) error {
}
_, err = t.WriteString(line + "\n")
if err != nil {
f.Close()
return err
}
}
defer f.Close()
f.Close()
}
t.Close()
return os.Rename(tmpPath, fPath)
}

View File

@ -120,8 +120,8 @@ func getSlackDeletePayload(p *api.DeletePayload, slack *SlackMeta) (*SlackPayloa
// getSlackForkPayload composes Slack payload for forked by a repository.
func getSlackForkPayload(p *api.ForkPayload, slack *SlackMeta) (*SlackPayload, error) {
baseLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
forkLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
baseLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
forkLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.FullName)
text := fmt.Sprintf("%s is forked to %s", baseLink, forkLink)
return &SlackPayload{
Channel: slack.Channel,