Skip to content

Commit 015a57a

Browse files
authored
Merge branch 'main' into main
2 parents cf10d77 + e31c616 commit 015a57a

39 files changed

+425
-200
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="[email protected]"
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="[email protected]"
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

assets/favicon.svg

Lines changed: 31 additions & 0 deletions
Loading

build/generate-images.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {fileURLToPath} from 'url';
88
const {readFile, writeFile} = fs.promises;
99
const __dirname = dirname(fileURLToPath(import.meta.url));
1010
const logoFile = resolve(__dirname, '../assets/logo.svg');
11+
const faviconFile = resolve(__dirname, '../assets/favicon.svg');
1112

1213
function exit(err) {
1314
if (err) console.error(err);
@@ -68,15 +69,17 @@ async function generate(svg, outputFile, {size, bg}) {
6869

6970
async function main() {
7071
const gitea = process.argv.slice(2).includes('gitea');
71-
const svg = await readFile(logoFile, 'utf8');
72+
const logoSvg = await readFile(logoFile, 'utf8');
73+
const faviconSvg = await readFile(faviconFile, 'utf8');
7274

7375
await Promise.all([
74-
generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
75-
generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
76-
generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
77-
generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
78-
generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
79-
gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
76+
generate(logoSvg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
77+
generate(logoSvg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
78+
generate(faviconSvg, resolve(__dirname, '../public/img/favicon.svg'), {size: 32}),
79+
generate(faviconSvg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
80+
generate(logoSvg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
81+
generate(logoSvg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
82+
gitea && generate(logoSvg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
8083
]);
8184
}
8285

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/usr/local/bin/gitea

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ CUSTOM_PATH="/data/gitea"
1313

1414
# Provide docker defaults
1515
GITEA_WORK_DIR="${GITEA_WORK_DIR:-$WORK_DIR}" GITEA_CUSTOM="${GITEA_CUSTOM:-$CUSTOM_PATH}" exec -a "$0" "$GITEA" $CONF_ARG "$@"
16-
17-

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/advanced/customizing-gitea.en-us.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ the url `http://gitea.domain.tld/assets/image.png`.
6060

6161
## Changing the logo
6262

63-
To build a custom logo clone the Gitea source repository, replace `assets/logo.svg` and run
64-
`make generate-images`. This will update below output files which you can then place in `$GITEA_CUSTOM/public/img` on your server:
63+
To build a custom logo and/or favicon clone the Gitea source repository, replace `assets/logo.svg` and/or `assets/favicon.svg` and run
64+
`make generate-images`. `assets/favicon.svg` is used for the favicon only. This will update below output files which you can then place in `$GITEA_CUSTOM/public/img` on your server:
6565

66-
- `public/img/logo.svg` - Used for favicon, site icon, app icon
66+
- `public/img/logo.svg` - Used for site icon, app icon
6767
- `public/img/logo.png` - Used for Open Graph
68-
- `public/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons
6968
- `public/img/avatar_default.png` - Used as the default avatar image
7069
- `public/img/apple-touch-icon.png` - Used on iOS devices for bookmarks
70+
- `public/img/favicon.svg` - Used for favicon
71+
- `public/img/favicon.png` - Used as fallback for browsers that don't support SVG favicons
7172

7273
In case the source image is not in vector format, you can attempt to convert a raster image using tools like [this](https://www.aconvert.com/image/png-to-svg/).
7374

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`:

docs/content/doc/help/faq.en-us.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ https://github.com/loganinak/MigrateGitlabToGogs
5252

5353
- WorkPath
5454
- Environment variable `GITEA_WORK_DIR`
55-
- Else binary location
55+
- Else `--work-path` flag
56+
- Else the directory that contains the Gitea binary
5657
- AppDataPath (default for database, indexers, etc.)
5758
- `APP_DATA_PATH` from `app.ini`
5859
- Else `%(WorkPath)/data`
@@ -63,8 +64,9 @@ https://github.com/loganinak/MigrateGitlabToGogs
6364
- Unix: Environment variable `HOME`
6465
- Windows: Environment variable `USERPROFILE`, else environment variables `HOMEDRIVE`+`HOMEPATH`
6566
- RepoRootPath
66-
- `ROOT` in `app.ini`
67-
- Else `%(AppDataPath)/gitea-repositories`
67+
- `ROOT` in the \[repository] section of `app.ini` if absolute
68+
- Else `%(AppWorkPath)/ROOT` if `ROOT` in the \[repository] section of `app.ini` if relative
69+
- Default `%(AppDataPath)/gitea-repositories`
6870
- INI (config file)
6971
- `-c` flag
7072
- Else `%(CustomPath)/conf/app.ini`

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,6 @@ In this option, the idea is that the host simply uses the `authorized_keys` that
389389
sudo chmod +x /usr/local/bin/gitea
390390
```
391391

392-
- For Gitea v1.15.x and earlier. As an administrative user on the host run:
393-
394-
```bash
395-
cat <<"EOF" | sudo tee /app/gitea/gitea
396-
#!/bin/sh
397-
ssh -p 2222 -o StrictHostKeyChecking=no [email protected] "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
398-
EOF
399-
sudo chmod +x /app/gitea/gitea
400-
```
401-
402392
Here is a detailed explanation what is happening when a SSH request is made:
403393

404394
1. The client adds their SSH public key to Gitea using the webpage.
@@ -431,7 +421,7 @@ Never add the `Gitea Host Key` as a SSH key to a user on the Gitea interface.
431421

432422
In this option, the idea is that the host simply uses the `authorized_keys` that gitea creates but at step 8 above we change the shell that the host runs to ssh directly into the docker and then run the shell there. This means that the `gitea` that is then run is the real docker `gitea`.
433423

434-
- In this case we setup as per SSHing Shim except instead of creating `/usr/local/bin/gitea` or `/app/gitea/gitea`
424+
- In this case we setup as per SSHing Shim except instead of creating `/usr/local/bin/gitea`
435425
we create a new shell for the git user. As an administrative user on the host run:
436426

437427
```bash

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ volumes:
301301
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
302302
```
303303

304-
在下一步中,需要在主机上创建一个名为 `/app/gitea/gitea` 的文件(具有可执行权限)。该文件将发出从主机到容器的 SSH 转发。将以下内容添加到 `/app/gitea/gitea`
304+
在下一步中,需要在主机上创建一个名为 `/user/local/bin/gitea` 的文件(具有可执行权限)。该文件将发出从主机到容器的 SSH 转发。将以下内容添加到 `/user/local/bin/gitea`
305305

306306
```bash
307307
ssh -p 2222 -o StrictHostKeyChecking=no [email protected] "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
@@ -324,14 +324,14 @@ ports:
324324
ssh-rsa <Gitea Host Key>
325325

326326
# other keys from users
327-
command="/app/gitea/gitea --config=/data/gitea/conf/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty <user pubkey>
327+
command="/user/local/bin/gitea --config=/data/gitea/conf/app.ini serv key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty <user pubkey>
328328
```
329329

330330
这是详细的说明,当发出 SSH 请求时会发生什么:
331331

332332
1. 使用 `git` 用户向主机发出 SSH 请求,例如 `git clone git@domain:user/repo.git`
333-
2.`/home/git/.ssh/authorized_keys` 中,该命令执行 `/app/gitea/gitea` 脚本。
334-
3. `/app/gitea/gitea` 将 SSH 请求转发到端口 2222,该端口已映射到容器的 SSH 端口(22)。
333+
2.`/home/git/.ssh/authorized_keys` 中,该命令执行 `/user/local/bin/gitea` 脚本。
334+
3. `/user/local/bin/gitea` 将 SSH 请求转发到端口 2222,该端口已映射到容器的 SSH 端口(22)。
335335
4. 由于 `/home/git/.ssh/authorized_keys` 中存在 `git` 用户的公钥,因此身份验证主机 → 容器成功,并且 SSH 请求转发到在 docker 容器中运行的 Gitea。
336336

337337
如果在 Gitea Web 界面中添加了新的 SSH 密钥,它将以与现有密钥相同的方式附加到 `.ssh/authorized_keys` 中。

docs/content/doc/packages/overview.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ menu:
1414

1515
# Package Registry
1616

17-
The Package Registry can be used as a public or private registry for common package managers.
17+
Starting with Gitea **1.17**, the Package Registry can be used as a public or private registry for common package managers.
1818

1919
**Table of Contents**
2020

docs/content/doc/usage/backup-and-restore.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The command has to be executed with the `RUN_USER = <OS_USERNAME>` specified in
5757
Example:
5858

5959
```none
60-
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf 'name=^<NAME_OF_DOCKER_CONTAINER>$') bash -c '/app/gitea/gitea dump -c </path/to/app.ini>'
60+
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf 'name=^<NAME_OF_DOCKER_CONTAINER>$') bash -c '/user/local/bin/gitea dump -c </path/to/app.ini>'
6161
```
6262

6363
\*Note: `--tempdir` refers to the temporary directory of the docker environment used by Gitea; if you have not specified a custom `--tempdir`, then Gitea uses `/tmp` or the `TMPDIR` environment variable of the docker container. For `--tempdir` adjust your `docker exec` command options accordingly.

docs/content/doc/usage/issue-pull-request-templates.en-us.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@ Possible file names for PR default merge message templates:
5252
- `.gitea/default_merge_message/MANUALLY-MERGED_TEMPLATE.md`
5353
- `.gitea/default_merge_message/REBASE-UPDATE-ONLY_TEMPLATE.md`
5454

55-
Possible file names for PR default merge message templates:
56-
57-
- `.gitea/default_merge_message/MERGE_TEMPLATE.md`
58-
- `.gitea/default_merge_message/REBASE_TEMPLATE.md`
59-
- `.gitea/default_merge_message/REBASE-MERGE_TEMPLATE.md`
60-
- `.gitea/default_merge_message/SQUASH_TEMPLATE.md`
61-
- `.gitea/default_merge_message/MANUALLY-MERGED_TEMPLATE.md`
62-
- `.gitea/default_merge_message/REBASE-UPDATE-ONLY_TEMPLATE.md`
63-
6455
You can use the following variables enclosed in `${}` inside these templates which follow [os.Expand](https://pkg.go.dev/os#Expand) syntax:
6556

6657
- BaseRepoOwnerName: Base repository owner name of this pull request

0 commit comments

Comments
 (0)