Skip to content

Commit 101063a

Browse files
authored
Merge branch 'main' into lunny/automerge_support_delete_branch
2 parents 774152b + 5f679c1 commit 101063a

File tree

310 files changed

+5089
-4343
lines changed

Some content is hidden

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

310 files changed

+5089
-4343
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ _test
99

1010
# IntelliJ
1111
.idea
12+
.run
1213

1314
# IntelliJ Gateway
1415
.uuid

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Gary Kim <[email protected]> (@gary-kim)
3131
Guillermo Prandi <[email protected]> (@guillep2k)
3232
Mura Li <[email protected]> (@typeless)
3333
6543 <[email protected]> (@6543)
34-
jaqra <[email protected]> (@jaqra)
3534
David Svantesson <[email protected]> (@davidsvantesson)
3635
a1012112796 <[email protected]> (@a1012112796)
3736
Karl Heinz Marbaise <[email protected]> (@khmarbaise)
@@ -63,3 +62,4 @@ Yu Liu <[email protected]> (@HEREYUA)
6362
Kemal Zebari <[email protected]> (@kemzeb)
6463
Rowan Bohde <[email protected]> (@bohde)
6564
hiifong <[email protected]> (@hiifong)
65+
metiftikci <[email protected]> (@metiftikci)

assets/go-licenses.json

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ func NewMainApp(appVer AppVersion) *cli.App {
165165
app.Commands = append(app.Commands, subCmdWithConfig...)
166166
app.Commands = append(app.Commands, subCmdStandalone...)
167167

168+
setting.InitGiteaEnvVars()
168169
return app
169170
}
170171

cmd/main_test.go

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package cmd
66
import (
77
"fmt"
88
"io"
9-
"os"
109
"path/filepath"
1110
"strings"
1211
"testing"
@@ -113,37 +112,17 @@ func TestCliCmd(t *testing.T) {
113112
_, _ = fmt.Fprint(ctx.App.Writer, makePathOutput(setting.AppWorkPath, setting.CustomPath, setting.CustomConf))
114113
return nil
115114
})
116-
var envBackup []string
117-
for _, s := range os.Environ() {
118-
if strings.HasPrefix(s, "GITEA_") && strings.Contains(s, "=") {
119-
envBackup = append(envBackup, s)
120-
}
121-
}
122-
clearGiteaEnv := func() {
123-
for _, s := range os.Environ() {
124-
if strings.HasPrefix(s, "GITEA_") {
125-
_ = os.Unsetenv(s)
126-
}
127-
}
128-
}
129-
defer func() {
130-
clearGiteaEnv()
131-
for _, s := range envBackup {
132-
k, v, _ := strings.Cut(s, "=")
133-
_ = os.Setenv(k, v)
134-
}
135-
}()
136-
137115
for _, c := range cases {
138-
clearGiteaEnv()
139-
for k, v := range c.env {
140-
_ = os.Setenv(k, v)
141-
}
142-
args := strings.Split(c.cmd, " ") // for test only, "split" is good enough
143-
r, err := runTestApp(app, args...)
144-
assert.NoError(t, err, c.cmd)
145-
assert.NotEmpty(t, c.exp, c.cmd)
146-
assert.Contains(t, r.Stdout, c.exp, c.cmd)
116+
t.Run(c.cmd, func(t *testing.T) {
117+
for k, v := range c.env {
118+
t.Setenv(k, v)
119+
}
120+
args := strings.Split(c.cmd, " ") // for test only, "split" is good enough
121+
r, err := runTestApp(app, args...)
122+
assert.NoError(t, err, c.cmd)
123+
assert.NotEmpty(t, c.exp, c.cmd)
124+
assert.Contains(t, r.Stdout, c.exp, c.cmd)
125+
})
147126
}
148127
}
149128

cmd/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
var CmdMigrate = &cli.Command{
1919
Name: "migrate",
2020
Usage: "Migrate the database",
21-
Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
21+
Description: `This is a command for migrating the database, so that you can run "gitea admin create user" before starting the server.`,
2222
Action: runMigrate,
2323
}
2424

cmd/web_acme.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func runACME(listenAddr string, m http.Handler) error {
5454
altTLSALPNPort = p
5555
}
5656

57-
magic := certmagic.NewDefault()
57+
magic := &certmagic.Default
5858
magic.Storage = &certmagic.FileStorage{Path: setting.AcmeLiveDirectory}
5959
// Try to use private CA root if provided, otherwise defaults to system's trust
6060
var certPool *x509.CertPool

custom/conf/app.example.ini

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ RUN_USER = ; git
7878
;; Set the domain for the server
7979
;DOMAIN = localhost
8080
;;
81-
;; Overwrite the automatically generated public URL. Necessary for proxies and docker.
82-
;ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
81+
;; The AppURL used by Gitea to generate absolute links, defaults to "{PROTOCOL}://{DOMAIN}:{HTTP_PORT}/".
82+
;; Most users should set it to the real website URL of their Gitea instance.
83+
;ROOT_URL =
8384
;;
8485
;; For development purpose only. It makes Gitea handle sub-path ("/sub-path/owner/repo/...") directly when debugging without a reverse proxy.
8586
;; DO NOT USE IT IN PRODUCTION!!!
@@ -103,8 +104,8 @@ RUN_USER = ; git
103104
;REDIRECT_OTHER_PORT = false
104105
;PORT_TO_REDIRECT = 80
105106
;;
106-
;; expect PROXY protocol header on connections to https redirector.
107-
;REDIRECTOR_USE_PROXY_PROTOCOL = %(USE_PROXY_PROTOCOL)s
107+
;; expect PROXY protocol header on connections to https redirector, defaults to USE_PROXY_PROTOCOL
108+
;REDIRECTOR_USE_PROXY_PROTOCOL =
108109
;; Minimum and maximum supported TLS versions
109110
;SSL_MIN_VERSION=TLSv1.2
110111
;SSL_MAX_VERSION=
@@ -128,13 +129,14 @@ RUN_USER = ; git
128129
;; most cases you do not need to change the default value. Alter it only if
129130
;; your SSH server node is not the same as HTTP node. For different protocol, the default
130131
;; values are different. If `PROTOCOL` is `http+unix`, the default value is `http://unix/`.
131-
;; If `PROTOCOL` is `fcgi` or `fcgi+unix`, the default value is `%(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`.
132-
;; If listen on `0.0.0.0`, the default value is `%(PROTOCOL)s://localhost:%(HTTP_PORT)s/`, Otherwise the default
133-
;; value is `%(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`.
134-
;LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/
132+
;; If `PROTOCOL` is `fcgi` or `fcgi+unix`, the default value is `{PROTOCOL}://{HTTP_ADDR}:{HTTP_PORT}/`.
133+
;; If listen on `0.0.0.0`, the default value is `{PROTOCOL}://localhost:{HTTP_PORT}/`.
134+
;; Otherwise the default value is `{PROTOCOL}://{HTTP_ADDR}:{HTTP_PORT}/`.
135+
;; Most users don't need (and shouldn't) set this value.
136+
;LOCAL_ROOT_URL =
135137
;;
136-
;; When making local connections pass the PROXY protocol header.
137-
;LOCAL_USE_PROXY_PROTOCOL = %(USE_PROXY_PROTOCOL)s
138+
;; When making local connections pass the PROXY protocol header, defaults to USE_PROXY_PROTOCOL
139+
;LOCAL_USE_PROXY_PROTOCOL =
138140
;;
139141
;; Disable SSH feature when not available
140142
;DISABLE_SSH = false
@@ -146,22 +148,26 @@ RUN_USER = ; git
146148
;SSH_SERVER_USE_PROXY_PROTOCOL = false
147149
;;
148150
;; Username to use for the builtin SSH server. If blank, then it is the value of RUN_USER.
149-
;BUILTIN_SSH_SERVER_USER = %(RUN_USER)s
151+
;BUILTIN_SSH_SERVER_USER =
150152
;;
151-
;; Domain name to be exposed in clone URL
152-
;SSH_DOMAIN = %(DOMAIN)s
153+
;; Domain name to be exposed in clone URL, defaults to DOMAIN or the domain part of ROOT_URL
154+
;SSH_DOMAIN =
153155
;;
154-
;; SSH username displayed in clone URLs.
155-
;SSH_USER = %(BUILTIN_SSH_SERVER_USER)s
156+
;; SSH username displayed in clone URLs. It defaults to BUILTIN_SSH_SERVER_USER or RUN_USER.
157+
;; If it is set to "(DOER_USERNAME)", it will use current signed-in user's username.
158+
;; This option is only for some advanced users who have configured their SSH reverse-proxy
159+
;; and need to use different usernames for git SSH clone.
160+
;; Most users should just leave it blank.
161+
;SSH_USER =
156162
;;
157163
;; The network interface the builtin SSH server should listen on
158164
;SSH_LISTEN_HOST =
159165
;;
160166
;; Port number to be exposed in clone URL
161167
;SSH_PORT = 22
162168
;;
163-
;; The port number the builtin SSH server should listen on
164-
;SSH_LISTEN_PORT = %(SSH_PORT)s
169+
;; The port number the builtin SSH server should listen on, defaults to SSH_PORT
170+
;SSH_LISTEN_PORT =
165171
;;
166172
;; Root path of SSH directory, default is '~/.ssh', but you have to use '/home/git/.ssh'.
167173
;SSH_ROOT_PATH =
@@ -188,7 +194,7 @@ RUN_USER = ; git
188194
;;
189195
;; For the built-in SSH server, choose the keypair to offer as the host key
190196
;; The private key should be at SSH_SERVER_HOST_KEY and the public SSH_SERVER_HOST_KEY.pub
191-
;; relative paths are made absolute relative to the %(APP_DATA_PATH)s
197+
;; relative paths are made absolute relative to the APP_DATA_PATH
192198
;SSH_SERVER_HOST_KEYS=ssh/gitea.rsa, ssh/gogs.rsa
193199
;;
194200
;; Directory to create temporary files in when testing public keys using ssh-keygen,
@@ -582,7 +588,7 @@ ENABLED = true
582588
[log]
583589
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
584590
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
585-
;; Root path for the log files - defaults to %(GITEA_WORK_DIR)/log
591+
;; Root path for the log files - defaults to "{AppWorkPath}/log"
586592
;ROOT_PATH =
587593
;;
588594
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -682,8 +688,8 @@ LEVEL = Info
682688
;; The path of git executable. If empty, Gitea searches through the PATH environment.
683689
;PATH =
684690
;;
685-
;; The HOME directory for Git
686-
;HOME_PATH = %(APP_DATA_PATH)s/home
691+
;; The HOME directory for Git, defaults to "{APP_DATA_PATH}/home"
692+
;HOME_PATH =
687693
;;
688694
;; Disables highlight of added and removed changes
689695
;DISABLE_DIFF_HIGHLIGHT = false
@@ -946,8 +952,8 @@ LEVEL = Info
946952
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
947953
;[repository]
948954
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
949-
;; Root path for storing all repository data. By default, it is set to %(APP_DATA_PATH)s/gitea-repositories.
950-
;; A relative path is interpreted as _`AppWorkPath`_/%(ROOT)s
955+
;; Root path for storing all repository data. By default, it is set to "{APP_DATA_PATH}/gitea-repositories".
956+
;; A relative path is interpreted as "{AppWorkPath}/{ROOT}" (use AppWorkPath as base path).
951957
;ROOT =
952958
;;
953959
;; The script type this server supports. Usually this is `bash`, but some users report that only `sh` is available.
@@ -1485,6 +1491,10 @@ LEVEL = Info
14851491
;REPO_INDEXER_EXCLUDE =
14861492
;;
14871493
;MAX_FILE_SIZE = 1048576
1494+
;;
1495+
;; Bleve engine has performance problems with fuzzy search, so we limit the fuzziness to 0 by default to disable it.
1496+
;; If you'd like to enable it, you can set it to a value between 0 and 2.
1497+
;TYPE_BLEVE_MAX_FUZZINESS = 0
14881498

14891499
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14901500
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1502,7 +1512,8 @@ LEVEL = Info
15021512
;TYPE = persistable-channel
15031513
;;
15041514
;; data-dir for storing persistable queues and level queues, individual queues will default to `queues/common` meaning the queue is shared.
1505-
;DATADIR = queues/ ; Relative paths will be made absolute against `%(APP_DATA_PATH)s`.
1515+
;; Relative paths will be made absolute against "APP_DATA_PATH"
1516+
;DATADIR = queues/
15061517
;;
15071518
;; Default queue length before a channel queue will block
15081519
;LENGTH = 100000

go.mod

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ require (
2424
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0
2525
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1
2626
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
27-
github.com/ProtonMail/go-crypto v1.0.0
27+
github.com/ProtonMail/go-crypto v1.1.4
2828
github.com/PuerkitoBio/goquery v1.10.0
2929
github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.7.3
30-
github.com/alecthomas/chroma/v2 v2.14.0
30+
github.com/alecthomas/chroma/v2 v2.15.0
3131
github.com/aws/aws-sdk-go-v2/credentials v1.17.42
3232
github.com/aws/aws-sdk-go-v2/service/codecommit v1.27.3
3333
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
@@ -54,8 +54,8 @@ require (
5454
github.com/go-chi/cors v1.2.1
5555
github.com/go-co-op/gocron v1.37.0
5656
github.com/go-enry/go-enry/v2 v2.9.1
57-
github.com/go-git/go-billy/v5 v5.6.0
58-
github.com/go-git/go-git/v5 v5.12.0
57+
github.com/go-git/go-billy/v5 v5.6.1
58+
github.com/go-git/go-git/v5 v5.13.1
5959
github.com/go-ldap/ldap/v3 v3.4.8
6060
github.com/go-redsync/redsync/v4 v4.13.0
6161
github.com/go-sql-driver/mysql v1.8.1
@@ -71,7 +71,6 @@ require (
7171
github.com/google/uuid v1.6.0
7272
github.com/gorilla/feeds v1.2.0
7373
github.com/gorilla/sessions v1.4.0
74-
github.com/h2non/gock v1.2.0
7574
github.com/hashicorp/go-version v1.7.0
7675
github.com/hashicorp/golang-lru/v2 v2.0.7
7776
github.com/huandu/xstrings v1.5.0
@@ -107,28 +106,28 @@ require (
107106
github.com/sassoftware/go-rpmutils v0.4.0
108107
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3
109108
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92
110-
github.com/stretchr/testify v1.9.0
109+
github.com/stretchr/testify v1.10.0
111110
github.com/syndtr/goleveldb v1.0.0
112111
github.com/tstranex/u2f v1.0.0
113112
github.com/ulikunitz/xz v0.5.12
114113
github.com/urfave/cli/v2 v2.27.5
115114
github.com/wneessen/go-mail v0.5.2
116-
github.com/xanzy/go-gitlab v0.112.0
117115
github.com/xeipuuv/gojsonschema v1.2.0
118116
github.com/yohcop/openid-go v1.0.1
119117
github.com/yuin/goldmark v1.7.8
120118
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
121119
github.com/yuin/goldmark-meta v1.1.0
122-
golang.org/x/crypto v0.31.0
120+
gitlab.com/gitlab-org/api/client-go v0.119.0
121+
golang.org/x/crypto v0.32.0
123122
golang.org/x/image v0.21.0
124-
golang.org/x/net v0.33.0
125-
golang.org/x/oauth2 v0.23.0
123+
golang.org/x/net v0.34.0
124+
golang.org/x/oauth2 v0.24.0
126125
golang.org/x/sync v0.10.0
127-
golang.org/x/sys v0.28.0
126+
golang.org/x/sys v0.29.0
128127
golang.org/x/text v0.21.0
129-
golang.org/x/tools v0.26.0
128+
golang.org/x/tools v0.29.0
130129
google.golang.org/grpc v1.67.1
131-
google.golang.org/protobuf v1.35.1
130+
google.golang.org/protobuf v1.36.0
132131
gopkg.in/ini.v1 v1.67.0
133132
gopkg.in/yaml.v3 v3.0.1
134133
mvdan.cc/xurls/v2 v2.5.0
@@ -187,7 +186,7 @@ require (
187186
github.com/couchbase/gomemcached v0.3.2 // indirect
188187
github.com/couchbase/goutils v0.1.2 // indirect
189188
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
190-
github.com/cyphar/filepath-securejoin v0.3.4 // indirect
189+
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
191190
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
192191
github.com/davidmz/go-pageant v1.0.2 // indirect
193192
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
@@ -220,7 +219,7 @@ require (
220219
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
221220
github.com/golang-sql/sqlexp v0.1.0 // indirect
222221
github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect
223-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
222+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
224223
github.com/golang/protobuf v1.5.4 // indirect
225224
github.com/golang/snappy v0.0.4 // indirect
226225
github.com/google/btree v1.1.3 // indirect
@@ -230,7 +229,6 @@ require (
230229
github.com/gorilla/handlers v1.5.2 // indirect
231230
github.com/gorilla/mux v1.8.1 // indirect
232231
github.com/gorilla/securecookie v1.1.2 // indirect
233-
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
234232
github.com/hashicorp/errwrap v1.1.0 // indirect
235233
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
236234
github.com/hashicorp/go-multierror v1.1.1 // indirect
@@ -255,6 +253,7 @@ require (
255253
github.com/mitchellh/copystructure v1.2.0 // indirect
256254
github.com/mitchellh/mapstructure v1.5.0 // indirect
257255
github.com/mitchellh/reflectwalk v1.0.2 // indirect
256+
github.com/mmcloughlin/avo v0.6.0 // indirect
258257
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
259258
github.com/modern-go/reflect2 v1.0.2 // indirect
260259
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
@@ -266,7 +265,7 @@ require (
266265
github.com/onsi/ginkgo v1.16.5 // indirect
267266
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
268267
github.com/pierrec/lz4/v4 v4.1.21 // indirect
269-
github.com/pjbgf/sha1cd v0.3.0 // indirect
268+
github.com/pjbgf/sha1cd v0.3.1 // indirect
270269
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
271270
github.com/prometheus/client_model v0.6.1 // indirect
272271
github.com/prometheus/common v0.60.1 // indirect
@@ -306,8 +305,8 @@ require (
306305
go.uber.org/multierr v1.11.0 // indirect
307306
go.uber.org/zap v1.27.0 // indirect
308307
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
309-
golang.org/x/mod v0.21.0 // indirect
310-
golang.org/x/time v0.7.0 // indirect
308+
golang.org/x/mod v0.22.0 // indirect
309+
golang.org/x/time v0.8.0 // indirect
311310
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
312311
gopkg.in/warnings.v0 v0.1.2 // indirect
313312
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)