Skip to content

Commit 021014a

Browse files
author
Guillermo Prandi
committed
Merge master into indexbyfileext
2 parents c6d5a79 + 28c5ae2 commit 021014a

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ var migrations = []Migration{
238238
NewMigration("change length of some repository columns", changeSomeColumnsLengthOfRepo),
239239
// v91 -> v92
240240
NewMigration("add index on owner_id of repository and type, review_id of comment", addIndexOnRepositoryAndComment),
241+
// v92 -> v93
242+
NewMigration("remove orphaned repository index statuses", removeLingeringIndexStatus),
241243
}
242244

243245
// Migrate database to current version

models/migrations/v92.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2019 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package migrations
6+
7+
import (
8+
"github.com/go-xorm/xorm"
9+
"xorm.io/builder"
10+
)
11+
12+
func removeLingeringIndexStatus(x *xorm.Engine) error {
13+
14+
_, err := x.Exec(builder.Delete(builder.NotIn("`repo_id`", builder.Select("`id`").From("`repository`"))).From("`repo_indexer_status`"))
15+
return err
16+
}

models/ssh_key.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,12 +685,14 @@ func rewriteAllPublicKeys(e Engine) error {
685685
}
686686
_, err = t.WriteString(line + "\n")
687687
if err != nil {
688+
f.Close()
688689
return err
689690
}
690691
}
691-
defer f.Close()
692+
f.Close()
692693
}
693694

695+
t.Close()
694696
return os.Rename(tmpPath, fPath)
695697
}
696698

models/webhook_slack.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ func getSlackDeletePayload(p *api.DeletePayload, slack *SlackMeta) (*SlackPayloa
120120

121121
// getSlackForkPayload composes Slack payload for forked by a repository.
122122
func getSlackForkPayload(p *api.ForkPayload, slack *SlackMeta) (*SlackPayload, error) {
123-
baseLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.Name)
124-
forkLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
123+
baseLink := SlackLinkFormatter(p.Forkee.HTMLURL, p.Forkee.FullName)
124+
forkLink := SlackLinkFormatter(p.Repo.HTMLURL, p.Repo.FullName)
125125
text := fmt.Sprintf("%s is forked to %s", baseLink, forkLink)
126126
return &SlackPayload{
127127
Channel: slack.Channel,

0 commit comments

Comments
 (0)