Skip to content

Commit aa5074b

Browse files
authored
Merge branch 'main' into ssh-sign
2 parents fcf0178 + 6ceef87 commit aa5074b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+1268
-2623
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ 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.15.7](https://github.com/go-gitea/gitea/releases/tag/v1.15.7) - 2021-12-01
8+
9+
* ENHANCEMENTS
10+
* Only allow webhook to send requests to allowed hosts (#17482) (#17510)
11+
* Fix login redirection links (#17451) (#17473)
12+
* BUGFIXES
13+
* Fix database inconsistent when admin change user email (#17549) (#17840)
14+
* Use correct user on releases (#17806) (#17818)
15+
* Fix commit count in tag view (#17698) (#17790)
16+
* Fix close issue but time watcher still running (#17643) (#17761)
17+
* Fix Migrate Description (#17692) (#17727)
18+
* Fix bug when project board get open issue number (#17703) (#17726)
19+
* Return 400 but not 500 when request archive with wrong format (#17691) (#17700)
20+
* Fix bug when read mysql database max lifetime (#17682) (#17690)
21+
* Fix database deadlock when update issue labels (#17649) (#17665)
22+
* Fix bug on detect issue/comment writer (#17592)
23+
* Remove appSubUrl from pasted images (#17572) (#17588)
24+
* Make `ParsePatch` more robust (#17573) (#17580)
25+
* Fix stats upon searching issues (#17566) (#17578)
26+
* Escape issue titles in comments list (#17555) (#17556)
27+
* Fix zero created time bug on commit api (#17546) (#17547)
28+
* Fix database keyword quote problem on migration v161 (#17522) (#17523)
29+
* Fix email with + when active (#17518) (#17520)
30+
* Stop double encoding blame commit messages (#17498) (#17500)
31+
* Quote the table name in CountOrphanedObjects (#17487) (#17488)
32+
* Run Migrate in Install rather than just SyncTables (#17475) (#17486)
33+
* BUILD
34+
* Fix golangci-lint warnings (#17598 et al) (#17668)
35+
* MISC
36+
* Preserve color when inverting emojis (#17797) (#17799)
37+
738
## [1.15.6](https://github.com/go-gitea/gitea/releases/tag/v1.15.6) - 2021-10-28
839

940
* BUGFIXES

contrib/pr/checkout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func main() {
215215
//Use git cli command for windows
216216
runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch))
217217
} else {
218-
ref := fmt.Sprintf("refs/pull/%s/head:%s", pr, branchRef)
218+
ref := fmt.Sprintf("%s%s/head:%s", gitea_git.PullPrefix, pr, branchRef)
219219
err = repo.Fetch(&git.FetchOptions{
220220
RemoteName: remoteUpstream,
221221
RefSpecs: []config.RefSpec{

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.15.6
21+
version: 1.15.7
2222
minGoVersion: 1.16
2323
goVersion: 1.17
2424
minNodeVersion: 12.17

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ require (
3737
github.com/ethantkoenig/rupture v1.0.0
3838
github.com/gliderlabs/ssh v0.3.3
3939
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
40-
github.com/go-chi/chi v1.5.4
4140
github.com/go-chi/chi/v5 v5.0.4
4241
github.com/go-chi/cors v1.2.0
4342
github.com/go-enry/go-enry/v2 v2.7.1

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1T
321321
github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
322322
github.com/go-asn1-ber/asn1-ber v1.5.3 h1:u7utq56RUFiynqUzgVMFDymapcOtQ/MZkh3H4QYkxag=
323323
github.com/go-asn1-ber/asn1-ber v1.5.3/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
324-
github.com/go-chi/chi v1.5.4 h1:QHdzF2szwjqVV4wmByUnTcsbIg7UGaQ0tPF2t5GcAIs=
325-
github.com/go-chi/chi v1.5.4/go.mod h1:uaf8YgoFazUOkPBG7fxPftUylNumIev9awIWOENIuEg=
326324
github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
327325
github.com/go-chi/chi/v5 v5.0.4 h1:5e494iHzsYBiyXQAHHuI4tyJS9M3V84OuX3ufIIGHFo=
328326
github.com/go-chi/chi/v5 v5.0.4/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=

models/issue.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"code.gitea.io/gitea/models/unit"
2121
user_model "code.gitea.io/gitea/models/user"
2222
"code.gitea.io/gitea/modules/base"
23+
"code.gitea.io/gitea/modules/git"
2324
"code.gitea.io/gitea/modules/log"
2425
"code.gitea.io/gitea/modules/references"
2526
api "code.gitea.io/gitea/modules/structs"
@@ -761,8 +762,8 @@ func (issue *Issue) ChangeRef(doer *user_model.User, oldRef string) (err error)
761762
if err = issue.loadRepo(db.GetEngine(ctx)); err != nil {
762763
return fmt.Errorf("loadRepo: %v", err)
763764
}
764-
oldRefFriendly := strings.TrimPrefix(oldRef, "refs/heads/")
765-
newRefFriendly := strings.TrimPrefix(issue.Ref, "refs/heads/")
765+
oldRefFriendly := strings.TrimPrefix(oldRef, git.BranchPrefix)
766+
newRefFriendly := strings.TrimPrefix(issue.Ref, git.BranchPrefix)
766767

767768
opts := &CreateCommentOptions{
768769
Type: CommentTypeChangeIssueRef,

models/migrations/v184.go

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

77
import (
8+
"context"
89
"fmt"
910

1011
"code.gitea.io/gitea/modules/setting"
@@ -19,6 +20,22 @@ func renameTaskErrorsToMessage(x *xorm.Engine) error {
1920
Status int `xorm:"index"`
2021
}
2122

23+
// This migration maybe rerun so that we should check if it has been run
24+
messageExist, err := x.Dialect().IsColumnExist(x.DB(), context.Background(), "task", "message")
25+
if err != nil {
26+
return err
27+
}
28+
29+
if messageExist {
30+
errorsExist, err := x.Dialect().IsColumnExist(x.DB(), context.Background(), "task", "errors")
31+
if err != nil {
32+
return err
33+
}
34+
if !errorsExist {
35+
return nil
36+
}
37+
}
38+
2239
sess := x.NewSession()
2340
defer sess.Close()
2441
if err := sess.Begin(); err != nil {
@@ -29,6 +46,13 @@ func renameTaskErrorsToMessage(x *xorm.Engine) error {
2946
return fmt.Errorf("error on Sync2: %v", err)
3047
}
3148

49+
if messageExist {
50+
// if both errors and message exist, drop message at first
51+
if err := dropTableColumns(sess, "task", "message"); err != nil {
52+
return err
53+
}
54+
}
55+
3256
switch {
3357
case setting.Database.UseMySQL:
3458
if _, err := sess.Exec("ALTER TABLE `task` CHANGE errors message text"); err != nil {

models/pull.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"code.gitea.io/gitea/models/db"
1414
"code.gitea.io/gitea/models/unit"
1515
user_model "code.gitea.io/gitea/models/user"
16+
"code.gitea.io/gitea/modules/git"
1617
"code.gitea.io/gitea/modules/log"
1718
"code.gitea.io/gitea/modules/setting"
1819
"code.gitea.io/gitea/modules/timeutil"
@@ -349,7 +350,7 @@ func (pr *PullRequest) GetDefaultSquashMessage() string {
349350

350351
// GetGitRefName returns git ref for hidden pull request branch
351352
func (pr *PullRequest) GetGitRefName() string {
352-
return fmt.Sprintf("refs/pull/%d/head", pr.Index)
353+
return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index)
353354
}
354355

355356
// IsChecking returns true if this pull request is still checking conflict.

models/user/user.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"crypto/sha256"
1111
"crypto/subtle"
1212
"encoding/hex"
13-
"errors"
1413
"fmt"
1514
"net/url"
1615
"os"
@@ -73,11 +72,6 @@ const (
7372
EmailNotificationsDisabled = "disabled"
7473
)
7574

76-
var (
77-
// ErrUserNameIllegal user name contains illegal characters error
78-
ErrUserNameIllegal = errors.New("User name contains illegal characters")
79-
)
80-
8175
// User represents the object of individual and member of organization.
8276
type User struct {
8377
ID int64 `xorm:"pk autoincr"`

modules/convert/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func ToAPIPullRequest(pr *models.PullRequest, doer *user_model.User) *api.PullRe
7979
},
8080
Head: &api.PRBranchInfo{
8181
Name: pr.HeadBranch,
82-
Ref: fmt.Sprintf("refs/pull/%d/head", pr.Index),
82+
Ref: fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index),
8383
RepoID: -1,
8484
},
8585
}

modules/git/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func CommitChangesWithArgs(repoPath string, args []string, opts CommitChangesOpt
141141
func AllCommitsCount(repoPath string, hidePRRefs bool, files ...string) (int64, error) {
142142
args := []string{"--all", "--count"}
143143
if hidePRRefs {
144-
args = append([]string{"--exclude=refs/pull/*"}, args...)
144+
args = append([]string{"--exclude=" + PullPrefix + "*"}, args...)
145145
}
146146
cmd := NewCommand("rev-list")
147147
cmd.AddArguments(args...)

modules/git/ref.go

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ package git
66

77
import "strings"
88

9+
const (
10+
// RemotePrefix is the base directory of the remotes information of git.
11+
RemotePrefix = "refs/remotes/"
12+
// PullPrefix is the base directory of the pull information of git.
13+
PullPrefix = "refs/pull/"
14+
15+
pullLen = len(PullPrefix)
16+
)
17+
918
// Reference represents a Git ref.
1019
type Reference struct {
1120
Name string
@@ -24,17 +33,17 @@ func (ref *Reference) ShortName() string {
2433
if ref == nil {
2534
return ""
2635
}
27-
if strings.HasPrefix(ref.Name, "refs/heads/") {
28-
return ref.Name[11:]
36+
if strings.HasPrefix(ref.Name, BranchPrefix) {
37+
return strings.TrimPrefix(ref.Name, BranchPrefix)
2938
}
30-
if strings.HasPrefix(ref.Name, "refs/tags/") {
31-
return ref.Name[10:]
39+
if strings.HasPrefix(ref.Name, TagPrefix) {
40+
return strings.TrimPrefix(ref.Name, TagPrefix)
3241
}
33-
if strings.HasPrefix(ref.Name, "refs/remotes/") {
34-
return ref.Name[13:]
42+
if strings.HasPrefix(ref.Name, RemotePrefix) {
43+
return strings.TrimPrefix(ref.Name, RemotePrefix)
3544
}
36-
if strings.HasPrefix(ref.Name, "refs/pull/") && strings.IndexByte(ref.Name[10:], '/') > -1 {
37-
return ref.Name[10 : strings.IndexByte(ref.Name[10:], '/')+10]
45+
if strings.HasPrefix(ref.Name, PullPrefix) && strings.IndexByte(ref.Name[pullLen:], '/') > -1 {
46+
return ref.Name[pullLen : strings.IndexByte(ref.Name[pullLen:], '/')+pullLen]
3847
}
3948

4049
return ref.Name
@@ -45,16 +54,16 @@ func (ref *Reference) RefGroup() string {
4554
if ref == nil {
4655
return ""
4756
}
48-
if strings.HasPrefix(ref.Name, "refs/heads/") {
57+
if strings.HasPrefix(ref.Name, BranchPrefix) {
4958
return "heads"
5059
}
51-
if strings.HasPrefix(ref.Name, "refs/tags/") {
60+
if strings.HasPrefix(ref.Name, TagPrefix) {
5261
return "tags"
5362
}
54-
if strings.HasPrefix(ref.Name, "refs/remotes/") {
63+
if strings.HasPrefix(ref.Name, RemotePrefix) {
5564
return "remotes"
5665
}
57-
if strings.HasPrefix(ref.Name, "refs/pull/") && strings.IndexByte(ref.Name[10:], '/') > -1 {
66+
if strings.HasPrefix(ref.Name, PullPrefix) && strings.IndexByte(ref.Name[pullLen:], '/') > -1 {
5867
return "pull"
5968
}
6069
return ""

modules/git/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func parseSize(objects string) *CountObject {
371371

372372
// GetLatestCommitTime returns time for latest commit in repository (across all branches)
373373
func GetLatestCommitTime(repoPath string) (time.Time, error) {
374-
cmd := NewCommand("for-each-ref", "--sort=-committerdate", "refs/heads/", "--count", "1", "--format=%(committerdate)")
374+
cmd := NewCommand("for-each-ref", "--sort=-committerdate", BranchPrefix, "--count", "1", "--format=%(committerdate)")
375375
stdout, err := cmd.RunInDir(repoPath)
376376
if err != nil {
377377
return time.Time{}, err

modules/git/repo_compare.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (repo *Repository) GetMergeBase(tmpRemote string, base, head string) (strin
3333
}
3434

3535
if tmpRemote != "origin" {
36-
tmpBaseName := "refs/remotes/" + tmpRemote + "/tmp_" + base
36+
tmpBaseName := RemotePrefix + tmpRemote + "/tmp_" + base
3737
// Fetch commit into a temporary branch in order to be able to handle commits and tags
3838
_, err := NewCommandContext(repo.Ctx, "fetch", tmpRemote, base+":"+tmpBaseName).RunInDir(repo.Path)
3939
if err == nil {

modules/git/repo_ref_nogogit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (repo *Repository) GetRefsFiltered(pattern string) ([]*Reference, error) {
6666
refName = refName[:len(refName)-1]
6767

6868
// refName cannot be HEAD but can be remotes or stash
69-
if strings.HasPrefix(refName, "/refs/remotes/") || refName == "/refs/stash" {
69+
if strings.HasPrefix(refName, RemotePrefix) || refName == "/refs/stash" {
7070
continue
7171
}
7272

modules/gitgraph/graph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func GetCommitGraph(r *git.Repository, page int, maxAllowedColors int, hidePRRef
2929
args = append(args, "--graph", "--date-order", "--decorate=full")
3030

3131
if hidePRRefs {
32-
args = append(args, "--exclude=refs/pull/*")
32+
args = append(args, "--exclude="+git.PullPrefix+"*")
3333
}
3434

3535
if len(branches) == 0 {

modules/migration/pullrequest.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ package migration
88
import (
99
"fmt"
1010
"time"
11+
12+
"code.gitea.io/gitea/modules/git"
1113
)
1214

1315
// PullRequest defines a standard pull request information
@@ -43,7 +45,7 @@ func (p *PullRequest) IsForkPullRequest() bool {
4345

4446
// GetGitRefName returns pull request relative path to head
4547
func (p PullRequest) GetGitRefName() string {
46-
return fmt.Sprintf("refs/pull/%d/head", p.Number)
48+
return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number)
4749
}
4850

4951
// PullRequestBranch represents a pull request branch

modules/structs/repo.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ const (
250250
GogsService // 5 gogs service
251251
OneDevService // 6 onedev service
252252
GitBucketService // 7 gitbucket service
253+
CodebaseService // 8 codebase service
253254
)
254255

255256
// Name represents the service type's name
@@ -273,6 +274,8 @@ func (gt GitServiceType) Title() string {
273274
return "OneDev"
274275
case GitBucketService:
275276
return "GitBucket"
277+
case CodebaseService:
278+
return "Codebase"
276279
case PlainGitService:
277280
return "Git"
278281
}
@@ -330,5 +333,6 @@ var (
330333
GogsService,
331334
OneDevService,
332335
GitBucketService,
336+
CodebaseService,
333337
}
334338
)

modules/templates/helper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func NewFuncMap() []template.FuncMap {
125125
"DateFmtShort": func(t time.Time) string {
126126
return t.Format("Jan 02, 2006")
127127
},
128-
"SizeFmt": base.FileSize,
129128
"CountFmt": base.FormatNumberSI,
130129
"SubStr": func(str string, start, length int) string {
131130
if len(str) == 0 {

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ migrate.gitlab.description = Migrate data from gitlab.com or other GitLab instan
937937
migrate.gitea.description = Migrate data from gitea.com or other Gitea instances.
938938
migrate.gogs.description = Migrate data from notabug.org or other Gogs instances.
939939
migrate.onedev.description = Migrate data from code.onedev.io or other OneDev instances.
940+
migrate.codebase.description = Migrate data from codebasehq.com.
940941
migrate.gitbucket.description = Migrate data from GitBucket instances.
941942
migrate.migrating_git = Migrating Git Data
942943
migrate.migrating_topics = Migrating Topics

options/locale/locale_es-ES.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ ssl_mode=SSL
138138
charset=Juego de caracteres
139139
path=Ruta
140140
sqlite_helper=Ruta del archivo de la base de datos SQLite3.<br>Escriba una ruta de acceso absoluta si ejecuta Gitea como servicio.
141+
reinstall_error=Usted está intentando instalar en una base de datos de Gitea existente
142+
reinstall_confirm_message=Reinstalar con una base de datos de Gitea existente puede causar múltiples problemas. En la mayoría de los casos, debería utilizar su actual "app.ini" para ejecutar Gitea. Si sabe lo que está haciendo, confirme lo siguiente:
141143
err_empty_db_path=La ruta a la base de datos SQLite3 no puede estar vacía.
142144
no_admin_and_disable_registration=No puede deshabilitar el auto-registro sin crear una cuenta de administrador.
143145
err_empty_admin_password=La contraseña del administrador no puede estar vacía.

0 commit comments

Comments
 (0)