Skip to content

Commit a70d330

Browse files
authored
Merge branch 'main' into lunny/extend_comment_treepath_length
2 parents 6817525 + fb247f6 commit a70d330

File tree

125 files changed

+4056
-4165
lines changed

Some content is hidden

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

125 files changed

+4056
-4165
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,6 @@ module.exports = {
831831
'sonarjs/no-inverted-boolean-check': [2],
832832
'sonarjs/no-nested-switch': [0],
833833
'sonarjs/no-nested-template-literals': [0],
834-
'sonarjs/no-one-iteration-loop': [2],
835834
'sonarjs/no-redundant-boolean': [2],
836835
'sonarjs/no-redundant-jump': [2],
837836
'sonarjs/no-same-line-conditional': [2],

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ cpu.out
7474
/tests/*.ini
7575
/tests/**/*.git/**/*.sample
7676
/node_modules
77-
/tools/node_modules
7877
/.venv
7978
/yarn.lock
8079
/yarn-error.log
8180
/npm-debug.log*
81+
/.pnpm-store
8282
/public/assets/js
8383
/public/assets/css
8484
/public/assets/fonts

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ hiifong <[email protected]> (@hiifong)
6363
metiftikci <[email protected]> (@metiftikci)
6464
Christopher Homberger <[email protected]> (@ChristopherHX)
6565
Tobias Balle-Petersen <[email protected]> (@tobiasbp)
66+
TheFox <[email protected]> (@TheFox0x7)

Makefile

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ XGO_VERSION := go-1.25.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
30-
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
30+
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.9.1
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/[email protected]
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected]
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.32.3
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@717e3cb29becaaf00e56953556c6d80f8a01b286
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
3737
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
@@ -96,6 +96,15 @@ STORED_VERSION_FILE := VERSION
9696
GITHUB_REF_TYPE ?= branch
9797
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
9898

99+
# Enable typescript support in Node.js before 22.18
100+
# TODO: Remove this once we can raise the minimum Node.js version to 22.18 (alpine >= 3.23)
101+
NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v 2>/dev/null | cut -c2- | tr '.' ' '))
102+
ifeq ($(shell test "$(NODE_VERSION)" -lt "022018000"; echo $$?),0)
103+
NODE_VARS := NODE_OPTIONS="--experimental-strip-types"
104+
else
105+
NODE_VARS :=
106+
endif
107+
99108
ifneq ($(GITHUB_REF_TYPE),branch)
100109
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
101110
GITEA_VERSION ?= $(VERSION)
@@ -127,7 +136,7 @@ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/m
127136
MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...)
128137

129138
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
130-
WEBPACK_CONFIGS := webpack.config.js tailwind.config.js
139+
WEBPACK_CONFIGS := webpack.config.ts tailwind.config.ts
131140
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
132141
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts
133142

@@ -153,9 +162,9 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(DIST)
153162
GO_DIRS := build cmd models modules routers services tests
154163
WEB_DIRS := web_src/js web_src/css
155164

156-
ESLINT_FILES := web_src/js tools *.js *.ts *.cjs tests/e2e
165+
ESLINT_FILES := web_src/js tools *.ts *.cjs tests/e2e
157166
STYLELINT_FILES := web_src/css web_src/js/components/*.vue
158-
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.js *.md *.yml *.yaml *.toml)) $(filter-out tools/misspellings.csv, $(wildcard tools/*))
167+
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) templates options/locale/locale_en-US.ini .github $(filter-out CHANGELOG.md, $(wildcard *.go *.md *.yml *.yaml *.toml)) $(filter-out tools/misspellings.csv, $(wildcard tools/*))
159168
EDITORCONFIG_FILES := templates .github/workflows options/locale/locale_en-US.ini
160169

161170
GO_SOURCES := $(wildcard *.go)
@@ -217,7 +226,6 @@ git-check:
217226
node-check:
218227
$(eval MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p'))
219228
$(eval MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' ')))
220-
$(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');))
221229
$(eval PNPM_MISSING := $(shell hash pnpm > /dev/null 2>&1 || echo 1))
222230
@if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" ]; then \
223231
echo "Gitea requires Node.js $(MIN_NODE_VERSION_STR) or greater to build. You can get it at https://nodejs.org/en/download/"; \
@@ -230,7 +238,7 @@ node-check:
230238

231239
.PHONY: clean-all
232240
clean-all: clean ## delete backend, frontend and integration files
233-
rm -rf $(WEBPACK_DEST_ENTRIES) node_modules tools/node_modules
241+
rm -rf $(WEBPACK_DEST_ENTRIES) node_modules
234242

235243
.PHONY: clean
236244
clean: ## delete backend and integration files
@@ -338,29 +346,29 @@ lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backen
338346

339347
.PHONY: lint-js
340348
lint-js: node_modules ## lint js files
341-
pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES)
342-
pnpm exec vue-tsc
349+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES)
350+
$(NODE_VARS) pnpm exec vue-tsc
343351

344352
.PHONY: lint-js-fix
345353
lint-js-fix: node_modules ## lint js files and fix issues
346-
pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES) --fix
347-
pnpm exec vue-tsc
354+
$(NODE_VARS) pnpm exec eslint --color --max-warnings=0 --ext js,ts,vue $(ESLINT_FILES) --fix
355+
$(NODE_VARS) pnpm exec vue-tsc
348356

349357
.PHONY: lint-css
350358
lint-css: node_modules ## lint css files
351-
pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES)
359+
$(NODE_VARS) pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES)
352360

353361
.PHONY: lint-css-fix
354362
lint-css-fix: node_modules ## lint css files and fix issues
355-
pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
363+
$(NODE_VARS) pnpm exec stylelint --color --max-warnings=0 $(STYLELINT_FILES) --fix
356364

357365
.PHONY: lint-swagger
358366
lint-swagger: node_modules ## lint swagger files
359-
pnpm exec spectral lint -q -F hint $(SWAGGER_SPEC)
367+
$(NODE_VARS) pnpm exec spectral lint -q -F hint $(SWAGGER_SPEC)
360368

361369
.PHONY: lint-md
362370
lint-md: node_modules ## lint markdown files
363-
pnpm exec markdownlint *.md
371+
$(NODE_VARS) pnpm exec markdownlint *.md
364372

365373
.PHONY: lint-spell
366374
lint-spell: ## lint spelling
@@ -407,7 +415,7 @@ lint-actions: ## lint action workflow files
407415

408416
.PHONY: lint-templates
409417
lint-templates: .venv node_modules ## lint template files
410-
@node tools/lint-templates-svg.js
418+
@node tools/lint-templates-svg.ts
411419
@uv run --frozen djlint $(shell find templates -type f -iname '*.tmpl')
412420

413421
.PHONY: lint-yaml
@@ -421,7 +429,7 @@ watch: ## watch everything and continuously rebuild
421429
.PHONY: watch-frontend
422430
watch-frontend: node-check node_modules ## watch frontend files and continuously rebuild
423431
@rm -rf $(WEBPACK_DEST_ENTRIES)
424-
NODE_ENV=development pnpm exec webpack --watch --progress
432+
NODE_ENV=development $(NODE_VARS) pnpm exec webpack --watch --progress --disable-interpret
425433

426434
.PHONY: watch-backend
427435
watch-backend: go-check ## watch backend files and continuously rebuild
@@ -437,7 +445,7 @@ test-backend: ## test backend files
437445

438446
.PHONY: test-frontend
439447
test-frontend: node_modules ## test frontend files
440-
pnpm exec vitest
448+
$(NODE_VARS) pnpm exec vitest
441449

442450
.PHONY: test-check
443451
test-check:
@@ -580,7 +588,7 @@ test-mssql-migration: migrations.mssql.test migrations.individual.mssql.test
580588

581589
.PHONY: playwright
582590
playwright: deps-frontend
583-
pnpm exec playwright install $(PLAYWRIGHT_FLAGS)
591+
$(NODE_VARS) pnpm exec playwright install $(PLAYWRIGHT_FLAGS)
584592

585593
.PHONY: test-e2e%
586594
test-e2e%: TEST_TYPE ?= e2e
@@ -844,13 +852,9 @@ deps-tools: ## install tool dependencies
844852
wait
845853

846854
node_modules: pnpm-lock.yaml
847-
pnpm install --frozen-lockfile
855+
$(NODE_VARS) pnpm install --frozen-lockfile
848856
@touch node_modules
849857

850-
tools/node_modules: tools/package.json
851-
cd tools && pnpm install
852-
@touch tools/node_modules
853-
854858
.venv: uv.lock
855859
uv sync
856860
@touch .venv
@@ -860,16 +864,16 @@ update: update-js update-py ## update js and py dependencies
860864

861865
.PHONY: update-js
862866
update-js: node-check | node_modules ## update js dependencies
863-
pnpm exec updates -u -f package.json
867+
$(NODE_VARS) pnpm exec updates -u -f package.json
864868
rm -rf node_modules pnpm-lock.yaml
865-
pnpm install
866-
pnpm exec nolyfill install
867-
pnpm install
869+
$(NODE_VARS) pnpm install
870+
$(NODE_VARS) pnpm exec nolyfill install
871+
$(NODE_VARS) pnpm install
868872
@touch node_modules
869873

870874
.PHONY: update-py
871875
update-py: node-check | node_modules ## update py dependencies
872-
pnpm exec updates -u -f pyproject.toml
876+
$(NODE_VARS) pnpm exec updates -u -f pyproject.toml
873877
rm -rf .venv uv.lock
874878
uv sync
875879
@touch .venv
@@ -881,13 +885,13 @@ $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) pnpm-lock.yaml
881885
@$(MAKE) -s node-check node_modules
882886
@rm -rf $(WEBPACK_DEST_ENTRIES)
883887
@echo "Running webpack..."
884-
@BROWSERSLIST_IGNORE_OLD_DATA=true pnpm exec webpack
888+
@BROWSERSLIST_IGNORE_OLD_DATA=true $(NODE_VARS) pnpm exec webpack --disable-interpret
885889
@touch $(WEBPACK_DEST)
886890

887891
.PHONY: svg
888892
svg: node-check | node_modules ## build svg files
889893
rm -rf $(SVG_DEST_DIR)
890-
node tools/generate-svg.js
894+
node tools/generate-svg.ts
891895

892896
.PHONY: svg-check
893897
svg-check: svg
@@ -901,7 +905,7 @@ svg-check: svg
901905

902906
.PHONY: lockfile-check
903907
lockfile-check:
904-
pnpm install --frozen-lockfile
908+
$(NODE_VARS) pnpm install --frozen-lockfile
905909
@diff=$$(git diff --color=always pnpm-lock.yaml); \
906910
if [ -n "$$diff" ]; then \
907911
echo "pnpm-lock.yaml is inconsistent with package.json"; \
@@ -925,8 +929,8 @@ generate-gitignore: ## update gitignore files
925929
$(GO) run build/generate-gitignores.go
926930

927931
.PHONY: generate-images
928-
generate-images: | node_modules tools/node_modules ## generate images (requires cairo development packages)
929-
cd tools && node generate-images.js $(TAGS)
932+
generate-images: | node_modules ## generate images
933+
cd tools && node generate-images.ts $(TAGS)
930934

931935
.PHONY: generate-manpage
932936
generate-manpage: ## generate manpage

build/code-batch-process.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func parseArgs() (mainOptions map[string]string, subCmd string, subArgs []string
181181
break
182182
}
183183
}
184-
return
184+
return mainOptions, subCmd, subArgs
185185
}
186186

187187
func showUsage() {

cmd/serv.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,6 @@ func runServ(ctx context.Context, c *cli.Command) error {
229229
username := repoPathFields[0]
230230
reponame := strings.TrimSuffix(repoPathFields[1], ".git") // “the-repo-name" or "the-repo-name.wiki"
231231

232-
// LowerCase and trim the repoPath as that's how they are stored.
233-
// This should be done after splitting the repoPath into username and reponame
234-
// so that username and reponame are not affected.
235-
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
236-
237232
if !repo.IsValidSSHAccessRepoName(reponame) {
238233
return fail(ctx, "Invalid repo name", "Invalid repo name: %s", reponame)
239234
}
@@ -280,6 +275,11 @@ func runServ(ctx context.Context, c *cli.Command) error {
280275
return fail(ctx, extra.UserMsg, "ServCommand failed: %s", extra.Error)
281276
}
282277

278+
// LowerCase and trim the repoPath as that's how they are stored.
279+
// This should be done after splitting the repoPath into username and reponame
280+
// so that username and reponame are not affected.
281+
repoPath = strings.ToLower(results.OwnerName + "/" + results.RepoName + ".git")
282+
283283
// LFS SSH protocol
284284
if verb == git.CmdVerbLfsTransfer {
285285
token, err := getLFSAuthToken(ctx, lfsVerb, results)

go.mod

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module code.gitea.io/gitea
22

3-
go 1.24.6
3+
go 1.25.1
44

55
// rfc5280 said: "The serial number is an integer assigned by the CA to each certificate."
66
// But some CAs use negative serial number, just relax the check. related:
@@ -287,6 +287,11 @@ require (
287287
gopkg.in/yaml.v2 v2.4.0 // indirect
288288
)
289289

290+
ignore (
291+
./.venv
292+
./node_modules
293+
)
294+
290295
replace github.com/jaytaylor/html2text => github.com/Necoro/html2text v0.0.0-20250804200300-7bf1ce1c7347
291296

292297
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

models/fixtures/user_redirect.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
id: 1
33
lower_name: olduser1
44
redirect_user_id: 1
5+
-
6+
id: 2
7+
lower_name: olduser2
8+
redirect_user_id: 2

modules/globallock/locker_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,13 @@ func testLocker(t *testing.T, locker Locker) {
105105
require.NoError(t, err)
106106

107107
wg := &sync.WaitGroup{}
108-
wg.Add(1)
109-
go func() {
110-
defer wg.Done()
108+
wg.Go(func() {
111109
started := time.Now()
112110
release, err := locker.Lock(t.Context(), "test") // should be blocked for seconds
113111
defer release()
114112
assert.Greater(t, time.Since(started), time.Second)
115113
assert.NoError(t, err)
116-
}()
114+
})
117115

118116
time.Sleep(2 * time.Second)
119117
release()

modules/log/event_writer_conn_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ func TestConnLogger(t *testing.T) {
6262
}
6363
expected := fmt.Sprintf("%s%s %s:%d:%s [%c] %s\n", prefix, dateString, event.Filename, event.Line, event.Caller, strings.ToUpper(event.Level.String())[0], event.MsgSimpleText)
6464
var wg sync.WaitGroup
65-
wg.Add(1)
66-
go func() {
67-
defer wg.Done()
65+
wg.Go(func() {
6866
listenReadAndClose(t, l, expected)
69-
}()
67+
})
7068
logger.SendLogEvent(&event)
7169
wg.Wait()
7270

0 commit comments

Comments
 (0)