Skip to content

Commit b55a86c

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: (32 commits) inline gitpod image (go-gitea#21494) [skip ci] Updated translations via Crowdin Do not send notifications for draft releases (go-gitea#21451) Update reverse-proxies.zh-cn.md (go-gitea#21484) Docs: Update the feature comparison to other Git Hosting Services (go-gitea#20933) Add some api integration tests (go-gitea#18872) probe if sha before exec git (go-gitea#21467) Fix incorrect notification commit url (go-gitea#21479) Localize all timestamps (go-gitea#21440) [skip ci] Updated translations via Crowdin Add system setting table with cache and also add cache supports for user setting (go-gitea#18058) Return 404 when user is not found on avatar (go-gitea#21476) Enforce grouped NuGet search results (go-gitea#21442) Display total commit count in hook message (go-gitea#21400) Refactor GetNextResourceIndex to make it work properly with transaction (go-gitea#21469) Simplify fmt-check (go-gitea#21458) update current stable version 1.17.3 changelog [skip ci] Updated translations via Crowdin Fix mermaid-related bugs (go-gitea#21431) ...
2 parents 1bdcdad + 6af1a0c commit b55a86c

File tree

186 files changed

+7897
-8366
lines changed

Some content is hidden

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

186 files changed

+7897
-8366
lines changed

Diff for: .drone.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ steps:
626626
commit_message: "[skip ci] Updated translations via Crowdin"
627627
remote: "git@github.com:go-gitea/gitea.git"
628628
environment:
629+
DRONE_COMMIT_AUTHOR_EMAIL: "teabot@gitea.io"
630+
DRONE_COMMIT_AUTHOR: GiteaBot
629631
GIT_PUSH_SSH_KEY:
630632
from_secret: git_push_ssh_key
631633

@@ -670,12 +672,14 @@ steps:
670672
pull: always
671673
settings:
672674
author_email: "teabot@gitea.io"
673-
author_name: GiteaBot
675+
author_name: "GiteaBot"
674676
branch: main
675677
commit: true
676-
commit_message: "[skip ci] Updated licenses and gitignores "
678+
commit_message: "[skip ci] Updated licenses and gitignores"
677679
remote: "git@github.com:go-gitea/gitea.git"
678680
environment:
681+
DRONE_COMMIT_AUTHOR_EMAIL: "teabot@gitea.io"
682+
DRONE_COMMIT_AUTHOR: "GiteaBot"
679683
GIT_PUSH_SSH_KEY:
680684
from_secret: git_push_ssh_key
681685

Diff for: .gitpod.yml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ vscode:
3131
- DavidAnson.vscode-markdownlint
3232
- johnsoncodehk.volar
3333
- ms-azuretools.vscode-docker
34+
- zixuanchen.vitest-explorer
3435

3536
ports:
3637
- name: Gitea

Diff for: .golangci.yml

-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ linters:
1212
- dupl
1313
#- gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
1414
- gofmt
15-
- misspell
1615
- gocritic
1716
- bidichk
1817
- ineffassign
@@ -148,9 +147,6 @@ issues:
148147
- path: models/issue_comment_list.go
149148
linters:
150149
- dupl
151-
- linters:
152-
- misspell
153-
text: '`Unknwon` is a misspelling of `Unknown`'
154150
- path: models/update.go
155151
linters:
156152
- unused

Diff for: CHANGELOG.md

+80
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,86 @@ 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.17.3](https://github.com/go-gitea/gitea/releases/tag/v1.17.3) - 2022-10-15
8+
9+
* SECURITY
10+
* Sanitize and Escape refs in git backend (#21464) (#21463)
11+
* Bump `golang.org/x/text` (#21412) (#21413)
12+
* Update bluemonday (#21281) (#21287)
13+
* ENHANCEMENTS
14+
* Fix empty container layer history and UI (#21251) (#21278)
15+
* Use en-US as fallback when using other default language (#21200) (#21256)
16+
* Make the vscode clone link respect transport protocol (#20557) (#21128)
17+
* BUGFIXES
18+
* Do DB update after merge in hammer context (#21401) (#21416)
19+
* Add Num{Issues,Pulls} stats checks (#21404) (#21414)
20+
* Stop logging CheckPath returns error: context canceled (#21064) (#21405)
21+
* Parse OAuth Authorization header when request omits client secret (#21351) (#21374)
22+
* Ignore port for loopback redirect URIs (#21293) (#21373)
23+
* Set SemverCompatible to false for Conan packages (#21275) (#21366)
24+
* Tag list should include draft releases with existing tags (#21263) (#21365)
25+
* Fix linked account translation (#21331) (#21334)
26+
* Make NuGet service index publicly accessible (#21242) (#21277)
27+
* Foreign ID conflicts if ID is 0 for each item (#21271) (#21272)
28+
* Use absolute links in feeds (#21229) (#21265)
29+
* Prevent invalid behavior for file reviewing when loading more files (#21230) (#21234)
30+
* Respect `REQUIRE_SIGNIN_VIEW` for packages (#20873) (#21232)
31+
* Treat git object mode 40755 as directory (#21195) (#21218)
32+
* Allow uppercase ASCII alphabet in PyPI package names (#21095) (#21217)
33+
* Fix limited user cannot view himself's profile (#21212)
34+
* Fix template bug of admin monitor (#21209)
35+
* Fix reaction of issues (#21185) (#21196)
36+
* Fix CSV diff for added/deleted files (#21189) (#21193)
37+
* Fix pagination limit parameter problem (#21111)
38+
* TESTING
39+
* Fix missing m.Run() in TestMain (#21341)
40+
* BUILD
41+
* Use Go 1.19 fmt for Gitea 1.17, sync emoji data (#21239)
42+
43+
## [1.17.2](https://github.com/go-gitea/gitea/releases/tag/v1.17.2) - 2022-09-06
44+
45+
* SECURITY
46+
* Double check CloneURL is acceptable (#20869) (#20892)
47+
* Add more checks in migration code (#21011) (#21050)
48+
* ENHANCEMENTS
49+
* Fix hard-coded timeout and error panic in API archive download endpoint (#20925) (#21051)
50+
* Improve arc-green code theme (#21039) (#21042)
51+
* Enable contenthash in filename for dynamic assets (#20813) (#20932)
52+
* Don't open new page for ext wiki on same repository (#20725) (#20910)
53+
* Disable doctor logging on panic (#20847) (#20898)
54+
* Remove calls to load Mirrors in user.Dashboard (#20855) (#20897)
55+
* Update codemirror to 5.65.8 (#20875)
56+
* Rework repo buttons (#20602, #20718) (#20719)
57+
* BUGFIXES
58+
* Ensure delete user deletes all comments (#21067) (#21068)
59+
* Delete unreferenced packages when deleting a package version (#20977) (#21060)
60+
* Redirect if user does not exist on admin pages (#20981) (#21059)
61+
* Set uploadpack.allowFilter etc on gitea serv to enable partial clones with ssh (#20902) (#21058)
62+
* Fix 500 on time in timeline API (#21052) (#21057)
63+
* Fill the specified ref in webhook test payload (#20961) (#21055)
64+
* Add another index for Action table on postgres (#21033) (#21054)
65+
* Fix broken insecureskipverify handling in redis connection uris (#20967) (#21053)
66+
* Add Dev, Peer and Optional dependencies to npm PackageMetadataVersion (#21017) (#21044)
67+
* Do not add links to Posters or Assignees with ID < 0 (#20577) (#21037)
68+
* Fix modified due date message (#20388) (#21032)
69+
* Fix missed sort bug (#21006)
70+
* Fix input.value attr for RequiredClaimName/Value (#20946) (#21001)
71+
* Change review buttons to icons to make space for text (#20934) (#20978)
72+
* Fix download archiver of a commit (#20962) (#20971)
73+
* Return 404 NotFound if requested attachment does not exist (#20886) (#20941)
74+
* Set no-tags in git fetch on compare (#20893) (#20936)
75+
* Allow multiple metadata files for Maven packages (#20674) (#20916)
76+
* Increase Content field size of gpg_key and public_key to MEDIUMTEXT (#20896) (#20911)
77+
* Fix mirror address setting not working (#20850) (#20904)
78+
* Fix push mirror address backend get error Address cause setting page display error (#20593) (#20901)
79+
* Fix panic when an invalid oauth2 name is passed (#20820) (#20900)
80+
* In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (#20837) (#20899)
81+
* Ensure that graceful start-up is informed of unused SSH listener (#20877) (#20888)
82+
* Pad GPG Key ID with preceding zeroes (#20878) (#20885)
83+
* Fix SQL Query for `SearchTeam` (#20844) (#20872)
84+
* Fix the mode of custom dir to 0700 in docker-rootless (#20861) (#20867)
85+
* Fix UI mis-align for PR commit history (#20845) (#20859)
86+
787
## [1.17.1](https://github.com/go-gitea/gitea/releases/tag/1.17.1) - 2022-08-17
888

989
* SECURITY

Diff for: CONTRIBUTING.md

+10
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,16 @@ If your PR could cause a breaking change you must add a BREAKING section to this
146146

147147
To explain how this could affect users and how to mitigate these changes.
148148

149+
Once code review starts on your PR, do not rebase nor squash your branch as it makes it
150+
difficult to review the new changes. Only if there is a need, sync your branch by merging
151+
the base branch into yours. Don't worry about merge commits messing up your tree as
152+
the final merge process squashes all commits into one, with the visible commit message (first
153+
line) being the PR title + PR index and description being the PR's first comment.
154+
155+
Once your PR gets the `lgtm/done` label, don't worry about keeping it up-to-date or breaking
156+
builds (unless there's a merge conflict or a request is made by a maintainer to make
157+
modifications). It is the maintainer team's responsibility from this point to get it merged.
158+
149159
## Styleguide
150160

151161
For imports you should use the following format (*without* the comments)

Diff for: Makefile

+17-19
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ TEST_TAGS ?= sqlite sqlite_unlock_notify
130130
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR)
131131

132132
GO_DIRS := cmd tests models modules routers build services tools
133+
WEB_DIRS := web_src/js web_src/less
133134

134135
GO_SOURCES := $(wildcard *.go)
135136
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go)
@@ -263,11 +264,24 @@ clean:
263264

264265
.PHONY: fmt
265266
fmt:
266-
@MISSPELL_PACKAGE=$(MISSPELL_PACKAGE) GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
267+
GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
267268
$(eval TEMPLATES := $(shell find templates -type f -name '*.tmpl'))
268269
@# strip whitespace after '{{' and before `}}` unless there is only whitespace before it
269270
@$(SED_INPLACE) -e 's/{{[ ]\{1,\}/{{/g' -e '/^[ ]\{1,\}}}/! s/[ ]\{1,\}}}/}}/g' $(TEMPLATES)
270271

272+
.PHONY: fmt-check
273+
fmt-check: fmt
274+
@diff=$$(git diff $(GO_SOURCES) templates $(WEB_DIRS)); \
275+
if [ -n "$$diff" ]; then \
276+
echo "Please run 'make fmt' and commit the result:"; \
277+
echo "$${diff}"; \
278+
exit 1; \
279+
fi
280+
281+
.PHONY: misspell-check
282+
misspell-check:
283+
go run $(MISSPELL_PACKAGE) -error -i unknwon $(GO_DIRS) $(WEB_DIRS)
284+
271285
.PHONY: vet
272286
vet:
273287
@echo "Running go vet..."
@@ -311,30 +325,14 @@ errcheck:
311325
@echo "Running errcheck..."
312326
$(GO) run $(ERRCHECK_PACKAGE) $(GO_PACKAGES)
313327

314-
.PHONY: fmt-check
315-
fmt-check:
316-
@# get all go files and run gitea-fmt (with gofmt) on them
317-
@diff=$$(MISSPELL_PACKAGE=$(MISSPELL_PACKAGE) GOFUMPT_PACKAGE=$(GOFUMPT_PACKAGE) $(GO) run build/code-batch-process.go gitea-fmt -l '{file-list}'); \
318-
if [ -n "$$diff" ]; then \
319-
echo "Please run 'make fmt' and commit the result:"; \
320-
echo "$${diff}"; \
321-
exit 1; \
322-
fi
323-
@diff2=$$(git diff templates); \
324-
if [ -n "$$diff2" ]; then \
325-
echo "Please run 'make fmt' and commit the result:"; \
326-
echo "$${diff2}"; \
327-
exit 1; \
328-
fi
329-
330328
.PHONY: checks
331329
checks: checks-frontend checks-backend
332330

333331
.PHONY: checks-frontend
334332
checks-frontend: lockfile-check svg-check
335333

336334
.PHONY: checks-backend
337-
checks-backend: tidy-check swagger-check swagger-validate
335+
checks-backend: tidy-check swagger-check fmt-check misspell-check swagger-validate
338336

339337
.PHONY: lint
340338
lint: lint-frontend lint-backend
@@ -372,7 +370,7 @@ test-backend:
372370

373371
.PHONY: test-frontend
374372
test-frontend: node_modules
375-
@NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --color
373+
npx vitest
376374

377375
.PHONY: test-check
378376
test-check:

Diff for: build/code-batch-process.go

+16-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
// Windows has a limitation for command line arguments, the size can not exceed 32KB.
23-
// So we have to feed the files to some tools (like gofmt/misspell) batch by batch
23+
// So we have to feed the files to some tools (like gofmt) batch by batch
2424

2525
// We also introduce a `gitea-fmt` command, it does better import formatting than gofmt/goimports. `gitea-fmt` calls `gofmt` internally.
2626

@@ -195,7 +195,6 @@ Options:
195195
196196
Commands:
197197
%[1]s gofmt ...
198-
%[1]s misspell ...
199198
200199
Arguments:
201200
{file-list} the file list
@@ -206,6 +205,17 @@ Example:
206205
`, "file-batch-exec")
207206
}
208207

208+
func getGoVersion() string {
209+
goModFile, err := os.ReadFile("go.mod")
210+
if err != nil {
211+
log.Fatalf(`Faild to read "go.mod": %v`, err)
212+
os.Exit(1)
213+
}
214+
goModVersionRegex := regexp.MustCompile(`go \d+\.\d+`)
215+
goModVersionLine := goModVersionRegex.Find(goModFile)
216+
return string(goModVersionLine[3:])
217+
}
218+
209219
func newFileCollectorFromMainOptions(mainOptions map[string]string) (fc *fileCollector, err error) {
210220
fileFilter := mainOptions["file-filter"]
211221
if fileFilter == "" {
@@ -228,9 +238,9 @@ func containsString(a []string, s string) bool {
228238
return false
229239
}
230240

231-
func giteaFormatGoImports(files []string, hasChangedFiles, doWriteFile bool) error {
241+
func giteaFormatGoImports(files []string, doWriteFile bool) error {
232242
for _, file := range files {
233-
if err := codeformat.FormatGoImports(file, hasChangedFiles, doWriteFile); err != nil {
243+
if err := codeformat.FormatGoImports(file, doWriteFile); err != nil {
234244
log.Printf("failed to format go imports: %s, err=%v", file, err)
235245
return err
236246
}
@@ -269,10 +279,8 @@ func main() {
269279
if containsString(subArgs, "-d") {
270280
log.Print("the -d option is not supported by gitea-fmt")
271281
}
272-
cmdErrors = append(cmdErrors, giteaFormatGoImports(files, containsString(subArgs, "-l"), containsString(subArgs, "-w")))
273-
cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("GOFUMPT_PACKAGE"), "-extra", "-lang", "1.17"}, substArgs...)))
274-
case "misspell":
275-
cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("MISSPELL_PACKAGE")}, substArgs...)))
282+
cmdErrors = append(cmdErrors, giteaFormatGoImports(files, containsString(subArgs, "-w")))
283+
cmdErrors = append(cmdErrors, passThroughCmd("go", append([]string{"run", os.Getenv("GOFUMPT_PACKAGE"), "-extra", "-lang", getGoVersion()}, substArgs...)))
276284
default:
277285
log.Fatalf("unknown cmd: %s %v", subCmd, subArgs)
278286
}

Diff for: build/codeformat/formatimports.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package codeformat
77
import (
88
"bytes"
99
"errors"
10-
"fmt"
1110
"io"
1211
"os"
1312
"sort"
@@ -159,7 +158,7 @@ func formatGoImports(contentBytes []byte) ([]byte, error) {
159158
}
160159

161160
// FormatGoImports format the imports by our rules (see unit tests)
162-
func FormatGoImports(file string, doChangedFiles, doWriteFile bool) error {
161+
func FormatGoImports(file string, doWriteFile bool) error {
163162
f, err := os.Open(file)
164163
if err != nil {
165164
return err
@@ -183,10 +182,6 @@ func FormatGoImports(file string, doChangedFiles, doWriteFile bool) error {
183182
return nil
184183
}
185184

186-
if doChangedFiles {
187-
fmt.Println(file)
188-
}
189-
190185
if doWriteFile {
191186
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
192187
if err != nil {

Diff for: contrib/init/gentoo/gitea

+33-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,43 @@
22

33
DIR=/var/lib/gitea
44
USER=git
5+
HOME=/home/${USER}
6+
GITEA_WORK_DIR=${DIR}
7+
EXECUTABLE=/usr/local/bin/gitea
58

9+
export USER
10+
export HOME
11+
export GITEA_WORK_DIR
12+
13+
name=$RC_SVCNAME
14+
cfgfile="/etc/$RC_SVCNAME/app.ini"
15+
command="${EXECUTABLE}"
16+
command_user="${USER}"
17+
command_args="web -c /etc/$RC_SVCNAME/app.ini"
18+
command_background="yes"
19+
pidfile="/run/$RC_SVCNAME/$RC_SVCNAME.pid"
620
start_stop_daemon_args="--user ${USER} --chdir ${DIR}"
7-
command="/usr/local/bin/gitea"
8-
command_args="web -c /etc/gitea/app.ini"
9-
command_background=yes
10-
pidfile=/run/gitea.pid
1121

1222
depend()
1323
{
1424
need net
25+
###
26+
# Don't forget to add the database service requirements
27+
###
28+
#after postgresql
29+
#after mysql
30+
#after mariadb
31+
#after memcached
32+
#after redis
33+
}
34+
35+
start_pre()
36+
{
37+
checkpath --directory --owner $command_user:$command_user --mode 0750 \
38+
/run/$RC_SVCNAME /var/log/$RC_SVCNAME
39+
##
40+
# If you want to bind Gitea to a port below 1024, uncomment
41+
# the value below
42+
##
43+
#setcap cap_net_bind_service=+ep "${EXECUTABLE}"
1544
}

Diff for: contrib/pr/checkout.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"fmt"
1515
"log"
1616
"net/http"
17-
"net/url"
1817
"os"
1918
"os/exec"
2019
"os/user"
@@ -62,11 +61,7 @@ func runPR() {
6261
}
6362
setting.AppWorkPath = curDir
6463
setting.StaticRootPath = curDir
65-
setting.GravatarSourceURL, err = url.Parse("https://secure.gravatar.com/avatar/")
66-
if err != nil {
67-
log.Fatalf("url.Parse: %v\n", err)
68-
}
69-
64+
setting.GravatarSource = "https://secure.gravatar.com/avatar/"
7065
setting.AppURL = "http://localhost:8080/"
7166
setting.HTTPPort = "8080"
7267
setting.SSH.Domain = "localhost"

Diff for: docs/config.yaml

+1-1
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.17.1
21+
version: 1.17.3
2222
minGoVersion: 1.18
2323
goVersion: 1.19
2424
minNodeVersion: 14

0 commit comments

Comments
 (0)