Skip to content

Commit 0264265

Browse files
authored
Merge branch 'main' into feature-svg-diff
2 parents 20d9cbb + a38f62a commit 0264265

File tree

135 files changed

+1229
-1658
lines changed

Some content is hidden

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

135 files changed

+1229
-1658
lines changed

.drone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ services:
153153
MYSQL_DATABASE: test
154154

155155
- name: mysql8
156-
image: mysql:8.0
156+
image: mysql:8
157157
environment:
158158
MYSQL_ALLOW_EMPTY_PASSWORD: yes
159159
MYSQL_DATABASE: testgitea
@@ -319,7 +319,7 @@ trigger:
319319
services:
320320
- name: pgsql
321321
pull: default
322-
image: postgres:9.5
322+
image: postgres:10
323323
environment:
324324
POSTGRES_DB: test
325325
POSTGRES_PASSWORD: postgres

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Please check the following:
22

3-
1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes.
3+
1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes.
44
2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/master/CONTRIBUTING.md
55
3. Describe what your pull request does and which issue you're targeting (if any)
66

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ endif
4343
ifeq ($(OS), Windows_NT)
4444
GOFLAGS := -v -buildmode=exe
4545
EXECUTABLE ?= gitea.exe
46+
else ifeq ($(OS), Windows)
47+
GOFLAGS := -v -buildmode=exe
48+
EXECUTABLE ?= gitea.exe
4649
else
4750
GOFLAGS := -v
4851
EXECUTABLE ?= gitea
@@ -61,8 +64,9 @@ EXTRA_GOFLAGS ?=
6164
MAKE_VERSION := $(shell $(MAKE) -v | head -n 1)
6265
MAKE_EVIDENCE_DIR := .make_evidence
6366

64-
ifneq ($(RACE_ENABLED),)
65-
GOTESTFLAGS ?= -race
67+
ifeq ($(RACE_ENABLED),true)
68+
GOFLAGS += -race
69+
GOTESTFLAGS += -race
6670
endif
6771

6872
STORED_VERSION_FILE := VERSION
@@ -377,7 +381,7 @@ test-check:
377381
.PHONY: test\#%
378382
test\#%:
379383
@echo "Running go test with -tags '$(TEST_TAGS)'..."
380-
@$(GO) test -mod=vendor -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES)
384+
@$(GO) test -mod=vendor $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES)
381385

382386
.PHONY: coverage
383387
coverage:

cmd/serv.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ func fail(userMessage, logMessage string, args ...interface{}) {
8181
}
8282
}
8383

84+
if len(logMessage) > 0 {
85+
_ = private.SSHLog(true, fmt.Sprintf(logMessage+": ", args...))
86+
}
87+
8488
os.Exit(1)
8589
}
8690

cmd/web.go

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"code.gitea.io/gitea/modules/graceful"
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
19-
"code.gitea.io/gitea/modules/util"
2019
"code.gitea.io/gitea/routers"
2120
"code.gitea.io/gitea/routers/routes"
2221

@@ -152,19 +151,6 @@ func setPort(port string) error {
152151
case setting.FCGI:
153152
case setting.FCGIUnix:
154153
default:
155-
// Save LOCAL_ROOT_URL if port changed
156-
cfg := ini.Empty()
157-
isFile, err := util.IsFile(setting.CustomConf)
158-
if err != nil {
159-
log.Fatal("Unable to check if %s is a file", err)
160-
}
161-
if isFile {
162-
// Keeps custom settings if there is already something.
163-
if err := cfg.Append(setting.CustomConf); err != nil {
164-
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)
165-
}
166-
}
167-
168154
defaultLocalURL := string(setting.Protocol) + "://"
169155
if setting.HTTPAddr == "0.0.0.0" {
170156
defaultLocalURL += "localhost"
@@ -173,10 +159,10 @@ func setPort(port string) error {
173159
}
174160
defaultLocalURL += ":" + setting.HTTPPort + "/"
175161

176-
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
177-
if err := cfg.SaveTo(setting.CustomConf); err != nil {
178-
return fmt.Errorf("Error saving generated LOCAL_ROOT_URL to custom config: %v", err)
179-
}
162+
// Save LOCAL_ROOT_URL if port changed
163+
setting.CreateOrAppendToCustomConf(func(cfg *ini.File) {
164+
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
165+
})
180166
}
181167
return nil
182168
}

custom/conf/app.example.ini

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,11 @@ ROUTER = console
444444
;ACCESS_LOG_TEMPLATE = {{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"
445445
;;
446446
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
447+
;;
448+
;; SSH log (Creates log from ssh git request)
449+
;;
450+
;ENABLE_SSH_LOG = false
451+
;;
447452
;; Other Settings
448453
;;
449454
;; Print Stacktraces with logs. (Rarely helpful.) Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "None"
@@ -1140,8 +1145,8 @@ PATH =
11401145
;;
11411146
;; When ISSUE_INDEXER_QUEUE_TYPE is levelqueue, this will be the path where the queue will be saved.
11421147
;; This can be overridden by `ISSUE_INDEXER_QUEUE_CONN_STR`.
1143-
;; default is indexers/issues.queue
1144-
;ISSUE_INDEXER_QUEUE_DIR = indexers/issues.queue
1148+
;; default is queues/common
1149+
;ISSUE_INDEXER_QUEUE_DIR = queues/common
11451150
;;
11461151
;; When `ISSUE_INDEXER_QUEUE_TYPE` is `redis`, this will store the redis connection string.
11471152
;; When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this is a directory or additional options of
@@ -1196,7 +1201,7 @@ PATH =
11961201
;; default to persistable-channel
11971202
;TYPE = persistable-channel
11981203
;;
1199-
;; data-dir for storing persistable queues and level queues, individual queues will be named by their type
1204+
;; data-dir for storing persistable queues and level queues, individual queues will default to `queues/common` meaning the queue is shared.
12001205
;DATADIR = queues/
12011206
;;
12021207
;; Default queue length before a channel queue will block
@@ -1226,7 +1231,7 @@ PATH =
12261231
;TIMEOUT = 15m30s
12271232
;;
12281233
;; Create a pool with this many workers
1229-
;WORKERS = 1
1234+
;WORKERS = 0
12301235
;;
12311236
;; Dynamically scale the worker pool to at this many workers
12321237
;MAX_WORKERS = 10
@@ -1238,7 +1243,7 @@ PATH =
12381243
;BOOST_TIMEOUT = 5m
12391244
;;
12401245
;; During a boost add BOOST_WORKERS
1241-
;BOOST_WORKERS = 5
1246+
;BOOST_WORKERS = 1
12421247

12431248
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12441249
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docker/root/etc/s6/openssh/setup

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ if [ -d /etc/ssh ]; then
4747
SSH_RSA_CERT="${SSH_RSA_CERT:+"HostCertificate "}${SSH_RSA_CERT}" \
4848
SSH_ECDSA_CERT="${SSH_ECDSA_CERT:+"HostCertificate "}${SSH_ECDSA_CERT}" \
4949
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
50+
SSH_MAX_STARTUPS="${SSH_MAX_STARTUPS:+"MaxStartups "}${SSH_MAX_STARTUPS}" \
51+
SSH_MAX_SESSIONS="${SSH_MAX_SESSIONS:+"MaxSessions "}${SSH_MAX_SESSIONS}" \
5052
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
5153

5254
chmod 0644 /etc/ssh/sshd_config

docker/root/etc/templates/sshd_config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ AddressFamily any
55
ListenAddress 0.0.0.0
66
ListenAddress ::
77

8+
${SSH_MAX_STARTUPS}
9+
${SSH_MAX_SESSIONS}
10+
811
LogLevel INFO
912

1013
HostKey /data/ssh/ssh_host_ed25519_key

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ update: $(THEME)
3131
$(THEME): $(THEME)/theme.toml
3232
$(THEME)/theme.toml:
3333
mkdir -p $$(dirname $@)
34-
curl -s $(ARCHIVE) | tar xz -C $$(dirname $@)
34+
curl -L -s $(ARCHIVE) | tar xz -C $$(dirname $@)

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ relation to port exhaustion.
350350
- `ISSUE_INDEXER_PATH`: **indexers/issues.bleve**: Index file used for issue search; available when ISSUE_INDEXER_TYPE is bleve and elasticsearch.
351351
- The next 4 configuration values are deprecated and should be set in `queue.issue_indexer` however are kept for backwards compatibility:
352352
- `ISSUE_INDEXER_QUEUE_TYPE`: **levelqueue**: Issue indexer queue, currently supports:`channel`, `levelqueue`, `redis`.
353-
- `ISSUE_INDEXER_QUEUE_DIR`: **indexers/issues.queue**: When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this will be the path where the queue will be saved.
353+
- `ISSUE_INDEXER_QUEUE_DIR`: **queues/common**: When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this will be the path where the queue will be saved. (Previously this was `indexers/issues.queue`.)
354354
- `ISSUE_INDEXER_QUEUE_CONN_STR`: **addrs=127.0.0.1:6379 db=0**: When `ISSUE_INDEXER_QUEUE_TYPE` is `redis`, this will store the redis connection string. When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this is a directory or additional options of the form `leveldb://path/to/db?option=value&....`, and overrides `ISSUE_INDEXER_QUEUE_DIR`.
355355
- `ISSUE_INDEXER_QUEUE_BATCH_NUMBER`: **20**: Batch queue number.
356356

@@ -370,7 +370,7 @@ relation to port exhaustion.
370370
## Queue (`queue` and `queue.*`)
371371

372372
- `TYPE`: **persistable-channel**: General queue type, currently support: `persistable-channel` (uses a LevelDB internally), `channel`, `level`, `redis`, `dummy`
373-
- `DATADIR`: **queues/**: Base DataDir for storing persistent and level queues. `DATADIR` for individual queues can be set in `queue.name` sections but will default to `DATADIR/`**`name`**.
373+
- `DATADIR`: **queues/**: Base DataDir for storing persistent and level queues. `DATADIR` for individual queues can be set in `queue.name` sections but will default to `DATADIR/`**`common`**. (Previously each queue would default to `DATADIR/`**`name`**.)
374374
- `LENGTH`: **20**: Maximal queue size before channel queues block
375375
- `BATCH_LENGTH`: **20**: Batch data before passing to the handler
376376
- `CONN_STR`: **redis://127.0.0.1:6379/0**: Connection string for the redis queue type. Options can be set using query params. Similarly LevelDB options can also be set using: **leveldb://relative/path?option=value** or **leveldb:///absolute/path?option=value**, and will override `DATADIR`
@@ -381,11 +381,11 @@ relation to port exhaustion.
381381
- `MAX_ATTEMPTS`: **10**: Maximum number of attempts to create the wrapped queue
382382
- `TIMEOUT`: **GRACEFUL_HAMMER_TIME + 30s**: Timeout the creation of the wrapped queue if it takes longer than this to create.
383383
- Queues by default come with a dynamically scaling worker pool. The following settings configure this:
384-
- `WORKERS`: **1**: Number of initial workers for the queue.
384+
- `WORKERS`: **0** (v1.14 and before: **1**): Number of initial workers for the queue.
385385
- `MAX_WORKERS`: **10**: Maximum number of worker go-routines for the queue.
386386
- `BLOCK_TIMEOUT`: **1s**: If the queue blocks for this time, boost the number of workers - the `BLOCK_TIMEOUT` will then be doubled before boosting again whilst the boost is ongoing.
387387
- `BOOST_TIMEOUT`: **5m**: Boost workers will timeout after this long.
388-
- `BOOST_WORKERS`: **5**: This many workers will be added to the worker pool if there is a boost.
388+
- `BOOST_WORKERS`: **1** (v1.14 and before: **5**): This many workers will be added to the worker pool if there is a boost.
389389

390390
## Admin (`admin`)
391391

@@ -657,6 +657,7 @@ Default templates for project boards:
657657
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default gitea logger.)
658658
NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
659659
- `ENABLE_ACCESS_LOG`: **false**: Creates an access.log in NCSA common log format, or as per the following template
660+
- `ENABLE_SSH_LOG`: **false**: save ssh log to log file
660661
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default gitea logger.)
661662
- `ACCESS_LOG_TEMPLATE`: **`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**: Sets the template used to create the access log.
662663
- The following variables are available:

docs/content/doc/installation/with-docker-rootless.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ services:
107107
+ - db
108108
+
109109
+ db:
110-
+ image: mysql:5.7
110+
+ image: mysql:8
111111
+ restart: always
112112
+ environment:
113113
+ - MYSQL_ROOT_PASSWORD=gitea
@@ -148,7 +148,7 @@ services:
148148
+ - db
149149
+
150150
+ db:
151-
+ image: postgres:9.6
151+
+ image: postgres:13
152152
+ restart: always
153153
+ environment:
154154
+ - POSTGRES_USER=gitea

docs/content/doc/installation/with-docker.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ services:
137137
+ - db
138138
+
139139
+ db:
140-
+ image: mysql:5.7
140+
+ image: mysql:8
141141
+ restart: always
142142
+ environment:
143143
+ - MYSQL_ROOT_PASSWORD=gitea
@@ -188,7 +188,7 @@ services:
188188
+ - db
189189
+
190190
+ db:
191-
+ image: postgres:9.6
191+
+ image: postgres:13
192192
+ restart: always
193193
+ environment:
194194
+ - POSTGRES_USER=gitea

docs/content/doc/installation/with-docker.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ services:
122122
+ - db
123123
+
124124
+ db:
125-
+ image: mysql:5.7
125+
+ image: mysql:8
126126
+ restart: always
127127
+ environment:
128128
+ - MYSQL_ROOT_PASSWORD=gitea
@@ -172,7 +172,7 @@ services:
172172
+ - db
173173
+
174174
+ db:
175-
+ image: postgres:9.6
175+
+ image: postgres:13
176176
+ restart: always
177177
+ environment:
178178
+ - POSTGRES_USER=gitea

integrations/README_ZH.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ make test-sqlite
2626
## 如何使用 mysql 数据库进行集成测试
2727
首先在docker容器里部署一个 mysql 数据库
2828
```
29-
docker run -e "MYSQL_DATABASE=test" -e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" -p 3306:3306 --rm --name mysql mysql:5.7 #(just ctrl-c to stop db and clean the container)
29+
docker run -e "MYSQL_DATABASE=test" -e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" -p 3306:3306 --rm --name mysql mysql:8 #(just ctrl-c to stop db and clean the container)
3030
```
3131
之后便可以基于这个数据库进行集成测试
3232
```
@@ -36,7 +36,7 @@ TEST_MYSQL_HOST=localhost:3306 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=root T
3636
## 如何使用 pgsql 数据库进行集成测试
3737
同上,首先在 docker 容器里部署一个 pgsql 数据库
3838
```
39-
docker run -e "POSTGRES_DB=test" -p 5432:5432 --rm --name pgsql postgres:9.5 #(just ctrl-c to stop db and clean the container)
39+
docker run -e "POSTGRES_DB=test" -p 5432:5432 --rm --name pgsql postgres:13 #(just ctrl-c to stop db and clean the container)
4040
```
4141
之后便可以基于这个数据库进行集成测试
4242
```

integrations/links_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func TestLinksNoLogin(t *testing.T) {
3535
"/user2/repo1",
3636
"/user2/repo1/projects",
3737
"/user2/repo1/projects/1",
38+
"/assets/img/404.png",
39+
"/assets/img/500.png",
3840
}
3941

4042
for _, link := range links {

integrations/pull_merge_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,8 @@ func TestCantMergeWorkInProgress(t *testing.T) {
197197
text := strings.TrimSpace(htmlDoc.doc.Find(".merge-section > .item").Last().Text())
198198
assert.NotEmpty(t, text, "Can't find WIP text")
199199

200-
// remove <strong /> from lang
201-
expected := i18n.Tr("en", "repo.pulls.cannot_merge_work_in_progress", "[wip]")
202-
replacer := strings.NewReplacer("<strong>", "", "</strong>", "")
203-
assert.Equal(t, replacer.Replace(expected), text, "Unable to find WIP text")
200+
assert.Contains(t, text, i18n.Tr("en", "repo.pulls.cannot_merge_work_in_progress"), "Unable to find WIP text")
201+
assert.Contains(t, text, "[wip]", "Unable to find WIP text")
204202
})
205203
}
206204

models/avatar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const DefaultAvatarSize = -1
4444
const DefaultAvatarPixelSize = 28
4545

4646
// AvatarRenderedSizeFactor is the factor by which the default size is increased for finer rendering
47-
const AvatarRenderedSizeFactor = 2
47+
const AvatarRenderedSizeFactor = 4
4848

4949
// HashEmail hashes email address to MD5 string.
5050
// https://en.gravatar.com/site/implement/hash/

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ var migrations = []Migration{
309309
NewMigration("Add LFS columns to Mirror", addLFSMirrorColumns),
310310
// v179 -> v180
311311
NewMigration("Convert avatar url to text", convertAvatarURLToText),
312+
// v180 -> v181
313+
NewMigration("Delete credentials from past migrations", deleteMigrationCredentials),
312314
}
313315

314316
// GetCurrentDBVersion returns the current db version

0 commit comments

Comments
 (0)