Skip to content

Commit 6bef922

Browse files
authored
Merge branch 'main' into auto-merge_webUI
2 parents 78e1174 + e32ab42 commit 6bef922

Some content is hidden

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

50 files changed

+473
-275
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.18-alpine3.15 AS build-env
2+
FROM golang:1.18-alpine3.16 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2323
# Begin env-to-ini build
2424
RUN go build contrib/environment-to-ini/environment-to-ini.go
2525

26-
FROM alpine:3.15
26+
FROM alpine:3.16
2727
LABEL maintainer="maintainers@gitea.io"
2828

2929
EXPOSE 22 3000

Dockerfile.rootless

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.18-alpine3.15 AS build-env
2+
FROM golang:1.18-alpine3.16 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2323
# Begin env-to-ini build
2424
RUN go build contrib/environment-to-ini/environment-to-ini.go
2525

26-
FROM alpine:3.15
26+
FROM alpine:3.16
2727
LABEL maintainer="maintainers@gitea.io"
2828

2929
EXPOSE 2222 3000

Makefile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ help:
195195
@echo " - swagger-validate check if the swagger spec is valid"
196196
@echo " - golangci-lint run golangci-lint linter"
197197
@echo " - vet examines Go source code and reports suspicious constructs"
198+
@echo " - tidy run go mod tidy"
198199
@echo " - test[\#TestSpecificName] run unit test"
199200
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
200201
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
@@ -369,16 +370,20 @@ unit-test-coverage:
369370
@echo "Running unit-test-coverage $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
370371
@$(GO) test $(GOTESTFLAGS) -timeout=20m -tags='$(TEST_TAGS)' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
371372

373+
.PHONY: tidy
374+
tidy:
375+
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
376+
$(GO) mod tidy -compat=$(MIN_GO_VERSION)
377+
372378
.PHONY: vendor
373-
vendor:
374-
$(GO) mod tidy && $(GO) mod vendor
379+
vendor: tidy
380+
$(GO) mod vendor
375381

376382
.PHONY: gomod-check
377-
gomod-check:
378-
@$(GO) mod tidy
383+
gomod-check: tidy
379384
@diff=$$(git diff go.sum); \
380385
if [ -n "$$diff" ]; then \
381-
echo "Please run '$(GO) mod tidy' and commit the result:"; \
386+
echo "Please run 'make tidy' and commit the result:"; \
382387
echo "$${diff}"; \
383388
exit 1; \
384389
fi

cmd/serv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ func runServ(c *cli.Context) error {
302302
if _, err := os.Stat(setting.RepoRootPath); err != nil {
303303
if os.IsNotExist(err) {
304304
return fail("Incorrect configuration.",
305-
"Directory `[repository]` `ROOT` was not found, please check if $GITEA_WORK_DIR is passed to the SSH connection or make `[repository]` `ROOT` an absolute value.")
305+
"Directory `[repository]` `ROOT` %s was not found, please check if $GITEA_WORK_DIR is passed to the SSH connection or make `[repository]` `ROOT` an absolute value.", setting.RepoRootPath)
306306
}
307307
}
308308

custom/conf/app.example.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,8 @@ PATH =
813813
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
814814
;[repository]
815815
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
816-
;; Root path for storing all repository data. It must be an absolute path. By default, it is stored in a sub-directory of `APP_DATA_PATH`.
816+
;; Root path for storing all repository data. By default, it is set to %(APP_DATA_PATH)/gitea-repositories.
817+
;; A relative path is interpreted as %(GITEA_WORK_DIR)/%(ROOT)
817818
;ROOT =
818819
;;
819820
;; The script type this server supports. Usually this is `bash`, but some users report that only `sh` is available.
@@ -938,7 +939,7 @@ PATH =
938939
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
939940
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
940941
;;
941-
;; List of prefixes used in Pull Request title to mark them as Work In Progress
942+
;; List of prefixes used in Pull Request title to mark them as Work In Progress (matched in a case-insensitive manner)
942943
;WORK_IN_PROGRESS_PREFIXES = WIP:,[WIP]
943944
;;
944945
;; List of keywords used in Pull Request comments to automatically close a related issue

docker/root/etc/s6/openssh/setup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ if [ -d /etc/ssh ]; then
4949
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
5050
SSH_MAX_STARTUPS="${SSH_MAX_STARTUPS:+"MaxStartups "}${SSH_MAX_STARTUPS}" \
5151
SSH_MAX_SESSIONS="${SSH_MAX_SESSIONS:+"MaxSessions "}${SSH_MAX_SESSIONS}" \
52+
SSH_INCLUDE_FILE="${SSH_INCLUDE_FILE:+"Include "}${SSH_INCLUDE_FILE}" \
5253
SSH_LOG_LEVEL=${SSH_LOG_LEVEL:-"INFO"} \
5354
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
5455

docker/root/etc/templates/sshd_config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ Banner none
4141
Subsystem sftp /usr/lib/ssh/sftp-server
4242

4343
AcceptEnv GIT_PROTOCOL
44+
45+
${SSH_INCLUDE_FILE}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
4242

4343
## Repository (`repository`)
4444

45-
- `ROOT`: **data/gitea-repositories/**: Root path for storing all repository data. It must be
46-
an absolute path. By default it is stored in a sub-directory of `APP_DATA_PATH`.
45+
- `ROOT`: **%(APP_DATA_PATH)/gitea-repositories**: Root path for storing all repository data.
46+
A relative path is interpreted as **%(GITEA_WORK_DIR)/%(ROOT)**.
4747
- `SCRIPT_TYPE`: **bash**: The script type this server supports. Usually this is `bash`,
4848
but some users report that only `sh` is available.
4949
- `DETECTED_CHARSETS_ORDER`: **UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE, ISO-8859, windows-1252, ISO-8859, windows-1250, ISO-8859, ISO-8859, ISO-8859, windows-1253, ISO-8859, windows-1255, ISO-8859, windows-1251, windows-1256, KOI8-R, ISO-8859, windows-1254, Shift_JIS, GB18030, EUC-JP, EUC-KR, Big5, ISO-2022, ISO-2022, ISO-2022, IBM424_rtl, IBM424_ltr, IBM420_rtl, IBM420_ltr**: Tie-break order of detected charsets - if the detected charsets have equal confidence, charsets earlier in the list will be chosen in preference to those later. Adding `defaults` will place the unnamed charsets at that point.
@@ -87,7 +87,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
8787
### Repository - Pull Request (`repository.pull-request`)
8888

8989
- `WORK_IN_PROGRESS_PREFIXES`: **WIP:,\[WIP\]**: List of prefixes used in Pull Request
90-
title to mark them as Work In Progress
90+
title to mark them as Work In Progress. These are matched in a case-insensitive manner.
9191
- `CLOSE_KEYWORDS`: **close**, **closes**, **closed**, **fix**, **fixes**, **fixed**, **resolve**, **resolves**, **resolved**: List of
9292
keywords used in Pull Request comments to automatically close a related issue
9393
- `REOPEN_KEYWORDS`: **reopen**, **reopens**, **reopened**: List of keywords used in Pull Request comments to automatically reopen

docs/content/doc/developers/guidelines-frontend.md

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Discouraged implementations:
6464
Only mark a function as `async` if and only if there are `await` calls
6565
or `Promise` returns inside the function.
6666

67-
It's not recommended to use `async` event listeners, which may lead to problems.
67+
It's not recommended to use `async` event listeners, which may lead to problems.
6868
The reason is that the code after await is executed outside the event dispatch.
6969
Reference: https://github.com/github/eslint-plugin-github/blob/main/docs/rules/async-preventdefault.md
7070

@@ -73,50 +73,6 @@ it's recommended to use `const _promise = asyncFoo()` to tell readers
7373
that this is done by purpose, we want to call the async function and ignore the Promise.
7474
Some lint rules and IDEs also have warnings if the returned Promise is not handled.
7575

76-
#### DOM Event Listener
77-
78-
```js
79-
el.addEventListener('click', (e) => {
80-
(async () => {
81-
await asyncFoo(); // recommended
82-
// then we shound't do e.preventDefault() after await, no effect
83-
})();
84-
85-
const _promise = asyncFoo(); // recommended
86-
87-
e.preventDefault(); // correct
88-
});
89-
90-
el.addEventListener('async', async (e) => { // not recommended but acceptable
91-
e.preventDefault(); // acceptable
92-
await asyncFoo(); // skip out event dispatch
93-
e.preventDefault(); // WRONG
94-
});
95-
```
96-
97-
#### jQuery Event Listener
98-
99-
```js
100-
$('#el').on('click', (e) => {
101-
(async () => {
102-
await asyncFoo(); // recommended
103-
// then we shound't do e.preventDefault() after await, no effect
104-
})();
105-
106-
const _promise = asyncFoo(); // recommended
107-
108-
e.preventDefault(); // correct
109-
return false; // correct
110-
});
111-
112-
$('#el').on('click', async (e) => { // not recommended but acceptable
113-
e.preventDefault(); // acceptable
114-
return false; // WRONG, jQuery expects the returned value is a boolean, not a Promise
115-
await asyncFoo(); // skip out event dispatch
116-
return false; // WRONG
117-
});
118-
```
119-
12076
### HTML Attributes and `dataset`
12177

12278
We forbid `dataset` usage, its camel-casing behaviour makes it hard to grep for attributes. However there are still some special cases, so the current guideline is:

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ Start local ElasticSearch instance using docker:
192192
```sh
193193
mkdir -p $(pwd)/data/elasticsearch
194194
sudo chown -R 1000:1000 $(pwd)/data/elasticsearch
195-
docker run --rm -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" -v "$(pwd)/data/elasticsearch:/usr/share/elasticsearch/data" docker.elastic.co/elasticsearch/elasticsearch:7.16.3
195+
docker run --rm --memory="4g" -p 127.0.0.1:9200:9200 -p 127.0.0.1:9300:9300 -e "discovery.type=single-node" -v "$(pwd)/data/elasticsearch:/usr/share/elasticsearch/data" docker.elastic.co/elasticsearch/elasticsearch:7.16.3
196196
```
197197

198198
Configure `app.ini`:

0 commit comments

Comments
 (0)