Skip to content

Commit 83c26e9

Browse files
committed
Merge branch 'release/v1.10' of git://github.com/go-gitea/gitea into wild/v1.10
2 parents 47f8d20 + 1aeeaa8 commit 83c26e9

File tree

12 files changed

+101
-42
lines changed

12 files changed

+101
-42
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.10.1](https://github.com/go-gitea/gitea/releases/tag/v1.10.1) - 2019-12-05
8+
* BUGFIXES
9+
* Fix max length check and limit in multiple repo forms (#9148) (#9204)
10+
* Properly fix displaying virtual session provider in admin panel (#9137) (#9203)
11+
* Upgrade levelqueue to 0.1.0 (#9192) (#9199)
12+
* Fix panic when diff (#9187) (#9193)
13+
* Smtp logger configuration sendTos should be an array (#9154) (#9157)
14+
* Always Show Password Field on Link Account Sign-in Page (#9150)
15+
* Create PR on Current Repository by Default (#8670) (#9141)
16+
* Fix race on indexer (#9136) (#9139)
17+
* Fix reCAPTCHA URL (#9119)
18+
* Hide migrated credentials (#9098)
19+
* Update golang.org/x/crypto vendor to use acme v2 (#9056) (#9085)
20+
* Fix password checks on admin create/edit user (#9076) (#9081)
21+
* Fix add search as a reserved username (#9063) (#9065)
22+
* Fix permission checks for close/reopen from commit (#8875) (#9033)
23+
* Ensure Written is set in GZIP ProxyResponseWriter (#9018) (#9025)
24+
* Fix broken link to branch from issue list (#9003) (#9021)
25+
* Fix wrong system notice when repository is empty (#9020)
26+
* Shadow password correctly for session config (#8984) (#9002)
27+
728
## [1.10.0](https://github.com/go-gitea/gitea/releases/tag/v1.10.0) - 2019-11-13
829
* BREAKING
930
* Fix deadline on update issue or PR via API (#8698)

integrations/api_repo_file_create_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ func getCreateFileOptions() api.CreateFileOptions {
3030
NewBranchName: "master",
3131
Message: "Making this new file new/file.txt",
3232
Author: api.Identity{
33-
Name: "John Doe",
34-
Email: "johndoe@example.com",
33+
Name: "Anne Doe",
34+
Email: "annedoe@example.com",
3535
},
3636
Committer: api.Identity{
37-
Name: "Jane Doe",
38-
Email: "janedoe@example.com",
37+
Name: "John Doe",
38+
Email: "johndoe@example.com",
3939
},
4040
},
4141
Content: contentEncoded,
@@ -77,8 +77,8 @@ func getExpectedFileResponseForCreate(commitID, treePath string) *api.FileRespon
7777
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID,
7878
Author: &api.CommitUser{
7979
Identity: api.Identity{
80-
Name: "Jane Doe",
81-
Email: "janedoe@example.com",
80+
Name: "Anne Doe",
81+
Email: "annedoe@example.com",
8282
},
8383
},
8484
Committer: &api.CommitUser{

integrations/api_repo_file_update_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func getUpdateFileOptions() *api.UpdateFileOptions {
3535
3636
},
3737
Committer: api.Identity{
38-
Name: "Jane Doe",
39-
Email: "janedoe@example.com",
38+
Name: "Anne Doe",
39+
Email: "annedoe@example.com",
4040
},
4141
},
4242
SHA: "103ff9234cefeee5ec5361d22b49fbb04d385885",
@@ -80,14 +80,14 @@ func getExpectedFileResponseForUpdate(commitID, treePath string) *api.FileRespon
8080
HTMLURL: setting.AppURL + "user2/repo1/commit/" + commitID,
8181
Author: &api.CommitUser{
8282
Identity: api.Identity{
83-
Name: "Jane Doe",
84-
Email: "janedoe@example.com",
83+
Name: "John Doe",
84+
Email: "johndoe@example.com",
8585
},
8686
},
8787
Committer: &api.CommitUser{
8888
Identity: api.Identity{
89-
Name: "John Doe",
90-
Email: "johndoe@example.com",
89+
Name: "Anne Doe",
90+
Email: "annedoe@example.com",
9191
},
9292
},
9393
Message: "My update of README.md\n",

models/repo.go

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,17 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
18601860
}
18611861
}
18621862

1863+
attachments := make([]*Attachment, 0, 20)
1864+
if err = sess.Join("INNER", "`release`", "`release`.id = `attachment`.release_id").
1865+
Where("`release`.repo_id = ?", repoID).
1866+
Find(&attachments); err != nil {
1867+
return err
1868+
}
1869+
releaseAttachments := make([]string, 0, len(attachments))
1870+
for i := 0; i < len(attachments); i++ {
1871+
releaseAttachments = append(releaseAttachments, attachments[i].LocalPath())
1872+
}
1873+
18631874
if err = deleteBeans(sess,
18641875
&Access{RepoID: repo.ID},
18651876
&Action{RepoID: repo.ID},
@@ -1910,13 +1921,13 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
19101921
return err
19111922
}
19121923

1913-
attachmentPaths := make([]string, 0, 20)
1914-
attachments := make([]*Attachment, 0, len(attachmentPaths))
1924+
attachments = attachments[:0]
19151925
if err = sess.Join("INNER", "issue", "issue.id = attachment.issue_id").
19161926
Where("issue.repo_id = ?", repoID).
19171927
Find(&attachments); err != nil {
19181928
return err
19191929
}
1930+
attachmentPaths := make([]string, 0, len(attachments))
19201931
for j := range attachments {
19211932
attachmentPaths = append(attachmentPaths, attachments[j].LocalPath())
19221933
}
@@ -1953,11 +1964,6 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
19531964
return err
19541965
}
19551966

1956-
// Remove attachment files.
1957-
for i := range attachmentPaths {
1958-
removeAllWithNotice(sess, "Delete attachment", attachmentPaths[i])
1959-
}
1960-
19611967
// Remove LFS objects
19621968
var lfsObjects []*LFSMetaObject
19631969
if err = sess.Where("repository_id=?", repoID).Find(&lfsObjects); err != nil {
@@ -1997,6 +2003,8 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
19972003
return fmt.Errorf("Commit: %v", err)
19982004
}
19992005

2006+
sess.Close()
2007+
20002008
if org.IsOrganization() {
20012009
if err = PrepareWebhooks(repo, HookEventRepository, &api.RepositoryPayload{
20022010
Action: api.HookRepoDeleted,
@@ -2009,6 +2017,19 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
20092017
go HookQueue.Add(repo.ID)
20102018
}
20112019

2020+
// We should always delete the files after the database transaction succeed. If
2021+
// we delete the file but the database rollback, the repository will be borken.
2022+
2023+
// Remove issue attachment files.
2024+
for i := range attachmentPaths {
2025+
removeAllWithNotice(x, "Delete issue attachment", attachmentPaths[i])
2026+
}
2027+
2028+
// Remove release attachment files.
2029+
for i := range releaseAttachments {
2030+
removeAllWithNotice(x, "Delete release attachment", releaseAttachments[i])
2031+
}
2032+
20122033
if len(repo.Avatar) > 0 {
20132034
avatarPath := repo.CustomAvatarPath()
20142035
if com.IsExist(avatarPath) {

modules/indexer/issues/indexer.go

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,26 +138,31 @@ func populateIssueIndexer() {
138138
}
139139

140140
for _, repo := range repos {
141-
is, err := models.Issues(&models.IssuesOptions{
142-
RepoIDs: []int64{repo.ID},
143-
IsClosed: util.OptionalBoolNone,
144-
IsPull: util.OptionalBoolNone,
145-
})
146-
if err != nil {
147-
log.Error("Issues: %v", err)
148-
continue
149-
}
150-
if err = models.IssueList(is).LoadDiscussComments(); err != nil {
151-
log.Error("LoadComments: %v", err)
152-
continue
153-
}
154-
for _, issue := range is {
155-
UpdateIssueIndexer(issue)
156-
}
141+
UpdateRepoIndexer(repo)
157142
}
158143
}
159144
}
160145

146+
// UpdateRepoIndexer add/update all issues of the repositories
147+
func UpdateRepoIndexer(repo *models.Repository) {
148+
is, err := models.Issues(&models.IssuesOptions{
149+
RepoIDs: []int64{repo.ID},
150+
IsClosed: util.OptionalBoolNone,
151+
IsPull: util.OptionalBoolNone,
152+
})
153+
if err != nil {
154+
log.Error("Issues: %v", err)
155+
return
156+
}
157+
if err = models.IssueList(is).LoadDiscussComments(); err != nil {
158+
log.Error("LoadComments: %v", err)
159+
return
160+
}
161+
for _, issue := range is {
162+
UpdateIssueIndexer(issue)
163+
}
164+
}
165+
161166
// UpdateIssueIndexer add/update an issue to the issue indexer
162167
func UpdateIssueIndexer(issue *models.Issue) {
163168
var comments []string

modules/migrations/base/uploader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Uploader interface {
1212
CreateTopics(topic ...string) error
1313
CreateMilestones(milestones ...*Milestone) error
1414
CreateReleases(releases ...*Release) error
15+
SyncTags() error
1516
CreateLabels(labels ...*Label) error
1617
CreateIssues(issues ...*Issue) error
1718
CreateComments(comments ...*Comment) error

modules/migrations/gitea.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,12 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
288288

289289
rels = append(rels, &rel)
290290
}
291-
if err := models.InsertReleases(rels...); err != nil {
292-
return err
293-
}
294291

295-
// sync tags to releases in database
292+
return models.InsertReleases(rels...)
293+
}
294+
295+
// SyncTags syncs releases with tags in the database
296+
func (g *GiteaLocalUploader) SyncTags() error {
296297
return models.SyncReleasesWithTags(g.repo, g.gitRepo)
297298
}
298299

modules/migrations/migrate.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ func migrateRepository(downloader base.Downloader, uploader base.Uploader, opts
165165
}
166166
releases = releases[relBatchSize:]
167167
}
168+
169+
// Once all releases (if any) are inserted, sync any remaining non-release tags
170+
if err := uploader.SyncTags(); err != nil {
171+
return err
172+
}
168173
}
169174

170175
var commentBatchSize = uploader.MaxBatchInsertSize("comment")

modules/notification/indexer/indexer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,8 @@ func (r *indexerNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod
107107
func (r *indexerNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) {
108108
issue_indexer.UpdateIssueIndexer(issue)
109109
}
110+
111+
func (r *indexerNotifier) NotifyMigrateRepository(doer *models.User, u *models.User, repo *models.Repository) {
112+
issue_indexer.UpdateRepoIndexer(repo)
113+
models.UpdateRepoIndexer(repo)
114+
}

modules/repofiles/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepo
6969

7070
message := strings.TrimSpace(opts.Message)
7171

72-
author, committer := GetAuthorAndCommitterUsers(opts.Committer, opts.Author, doer)
72+
author, committer := GetAuthorAndCommitterUsers(opts.Author, opts.Committer, doer)
7373

7474
t, err := NewTemporaryUploadRepository(repo)
7575
if err != nil {

0 commit comments

Comments
 (0)