Skip to content

Commit 4d1ad21

Browse files
authored
Merge branch 'main' into remove-showhide-assertion
2 parents 0eb10b1 + aa9c920 commit 4d1ad21

File tree

810 files changed

+7034
-5044
lines changed

Some content is hidden

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

810 files changed

+7034
-5044
lines changed

.gitpod.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ tasks:
2424
make watch-frontend
2525
openMode: split-right
2626
- name: Run docs
27-
before: sudo bash -c "$(grep 'https://github.com/gohugoio/hugo/releases/download' Makefile | tr -d '\')" # install hugo
28-
command: cd docs && make clean update && hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
27+
command: |
28+
gp sync-await setup
29+
cd docs
30+
make clean update
31+
hugo server -D -F --baseUrl $(gp url 1313) --liveReloadPort=443 --appendPort=false --bind=0.0.0.0
2932
openMode: split-right
3033

3134
vscode:

CHANGELOG.md

Lines changed: 350 additions & 0 deletions
Large diffs are not rendered by default.

MAINTAINERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Kees de Vries <[email protected]> (@Bwko)
55
Kim Carlbäcker <[email protected]> (@bkcsoft)
66
LefsFlare <[email protected]> (@LefsFlarey)
77
Lunny Xiao <[email protected]> (@lunny)
8-
Matthias Loibl <[email protected]> (@metalmatze)
98
Rachid Zarouali <[email protected]> (@xinity)
109
Rémy Boulanouar <[email protected]> (@DblK)
1110
Sandro Santilli <[email protected]> (@strk)
@@ -45,7 +44,7 @@ Jimmy Praet <[email protected]> (@jpraet)
4544
Leon Hofmeister <[email protected]> (@delvh)
4645
Wim <[email protected]> (@42wim)
4746
Jason Song <[email protected]> (@wolfogre)
48-
Yarden Shoham <hrsi88@gmail.com> (@yardenshoham)
47+
Yarden Shoham <git@yardenshoham.com> (@yardenshoham)
4948
Yu Tian <[email protected]> (@Zettat123)
5049
Eddie Yang <[email protected]> (@yp05327)
5150
Dong Ge <[email protected]> (@sillyguodong)

Makefile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ ifeq ($(RACE_ENABLED),true)
7777
endif
7878

7979
STORED_VERSION_FILE := VERSION
80+
HUGO_VERSION ?= 0.111.3
8081

8182
ifneq ($(DRONE_TAG),)
8283
VERSION ?= $(subst v,,$(DRONE_TAG))
@@ -130,7 +131,7 @@ TEST_TAGS ?= sqlite sqlite_unlock_notify
130131

131132
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)
132133

133-
GO_DIRS := cmd tests models modules routers build services tools
134+
GO_DIRS := build cmd models modules routers services tests
134135
WEB_DIRS := web_src/js web_src/css
135136

136137
GO_SOURCES := $(wildcard *.go)
@@ -188,6 +189,7 @@ help:
188189
@echo " - clean delete backend and integration files"
189190
@echo " - clean-all delete backend, frontend and integration files"
190191
@echo " - deps install dependencies"
192+
@echo " - deps-docs install docs dependencies"
191193
@echo " - deps-frontend install frontend dependencies"
192194
@echo " - deps-backend install backend dependencies"
193195
@echo " - deps-tools install tool dependencies"
@@ -217,7 +219,6 @@ help:
217219
@echo " - tidy run go mod tidy"
218220
@echo " - test[\#TestSpecificName] run unit test"
219221
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
220-
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
221222

222223
.PHONY: go-check
223224
go-check:
@@ -351,7 +352,7 @@ lint-backend: golangci-lint vet editorconfig-checker
351352

352353
.PHONY: watch
353354
watch:
354-
bash tools/watch.sh
355+
bash build/watch.sh
355356

356357
.PHONY: watch-frontend
357358
watch-frontend: node-check node_modules
@@ -815,14 +816,17 @@ release-docs: | $(DIST_DIRS) docs
815816
tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs/public .
816817

817818
.PHONY: docs
818-
docs:
819+
docs: deps-docs
820+
cd docs; make trans-copy clean build-offline;
821+
822+
.PHONY: deps-docs
823+
deps-docs:
819824
@hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
820-
curl -sL https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_0.74.3_Linux-64bit.tar.gz | tar zxf - -C /tmp && mv /tmp/hugo /usr/bin/hugo && chmod +x /usr/bin/hugo; \
825+
curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mkdir -p ~/go/bin && mv /tmp/hugo ~/go/bin/hugo && chmod +x ~/go/bin/hugo; \
821826
fi
822-
cd docs; make trans-copy clean build-offline;
823827

824828
.PHONY: deps
825-
deps: deps-frontend deps-backend deps-tools
829+
deps: deps-frontend deps-backend deps-tools deps-docs
826830

827831
.PHONY: deps-frontend
828832
deps-frontend: node_modules
@@ -934,10 +938,6 @@ generate-manpage:
934938
@gzip -9 man/man1/gitea.1 && echo man/man1/gitea.1.gz created
935939
@#TODO A small script that formats config-cheat-sheet.en-us.md nicely for use as a config man page
936940

937-
.PHONY: pr\#%
938-
pr\#%: clean-all
939-
$(GO) run contrib/pr/checkout.go $*
940-
941941
.PHONY: golangci-lint
942942
golangci-lint:
943943
$(GO) run $(GOLANGCI_LINT_PACKAGE) run

assets/go-licenses.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/backport-locales.go

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
//go:build ignore
5+
6+
package main
7+
8+
import (
9+
"fmt"
10+
"os"
11+
"os/exec"
12+
"path/filepath"
13+
"strings"
14+
15+
"gopkg.in/ini.v1"
16+
)
17+
18+
func main() {
19+
if len(os.Args) != 2 {
20+
println("usage: backport-locales <to-ref>")
21+
println("eg: backport-locales release/v1.19")
22+
os.Exit(1)
23+
}
24+
25+
ini.PrettyFormat = false
26+
mustNoErr := func(err error) {
27+
if err != nil {
28+
panic(err)
29+
}
30+
}
31+
collectInis := func(ref string) map[string]*ini.File {
32+
inis := map[string]*ini.File{}
33+
err := filepath.WalkDir("options/locale", func(path string, d os.DirEntry, err error) error {
34+
if err != nil {
35+
return err
36+
}
37+
if d.IsDir() || !strings.HasSuffix(d.Name(), ".ini") {
38+
return nil
39+
}
40+
cfg, err := ini.LoadSources(ini.LoadOptions{
41+
IgnoreInlineComment: true,
42+
UnescapeValueCommentSymbols: true,
43+
}, path)
44+
mustNoErr(err)
45+
inis[path] = cfg
46+
fmt.Printf("collecting: %s @ %s\n", path, ref)
47+
return nil
48+
})
49+
mustNoErr(err)
50+
return inis
51+
}
52+
53+
// collect new locales from current working directory
54+
inisNew := collectInis("HEAD")
55+
56+
// switch to the target ref, and collect the old locales
57+
cmd := exec.Command("git", "checkout", os.Args[1])
58+
cmd.Stdout = os.Stdout
59+
cmd.Stderr = os.Stderr
60+
mustNoErr(cmd.Run())
61+
inisOld := collectInis(os.Args[1])
62+
63+
// use old en-US as the base, and copy the new translations to the old locales
64+
enUsOld := inisOld["options/locale/locale_en-US.ini"]
65+
for path, iniOld := range inisOld {
66+
if iniOld == enUsOld {
67+
continue
68+
}
69+
iniNew := inisNew[path]
70+
if iniNew == nil {
71+
continue
72+
}
73+
for _, secEnUS := range enUsOld.Sections() {
74+
secOld := iniOld.Section(secEnUS.Name())
75+
secNew := iniNew.Section(secEnUS.Name())
76+
for _, keyEnUs := range secEnUS.Keys() {
77+
if secNew.HasKey(keyEnUs.Name()) {
78+
oldStr := secOld.Key(keyEnUs.Name()).String()
79+
newStr := secNew.Key(keyEnUs.Name()).String()
80+
if oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%") {
81+
fmt.Printf("WARNING: locale %s [%s]%s has different number of arguments, skipping\n", path, secEnUS.Name(), keyEnUs.Name())
82+
fmt.Printf("\told: %s\n", oldStr)
83+
fmt.Printf("\tnew: %s\n", newStr)
84+
fmt.Println("---- ")
85+
continue
86+
}
87+
secOld.Key(keyEnUs.Name()).SetValue(newStr)
88+
}
89+
}
90+
}
91+
mustNoErr(iniOld.SaveTo(path))
92+
}
93+
}

build/code-batch-process.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func newFileCollector(fileFilter string, batchSize int) (*fileCollector, error)
6565
"modules",
6666
"routers",
6767
"services",
68-
"tools",
6968
}
7069
co.includePatterns = append(co.includePatterns, regexp.MustCompile(`.*\.go$`))
7170

build/generate-emoji.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ func main() {
6060
// generate data
6161
buf, err := generate()
6262
if err != nil {
63-
log.Fatal(err)
63+
log.Fatalf("generate err: %v", err)
6464
}
6565

6666
// write
6767
err = os.WriteFile(*flagOut, buf, 0o644)
6868
if err != nil {
69-
log.Fatal(err)
69+
log.Fatalf("WriteFile err: %v", err)
7070
}
7171
}
7272

build/generate-svg.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,22 @@ async function processFile(file, {prefix, fullName} = {}) {
2525
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
2626
}
2727

28+
// Set the `xmlns` attribute so that the files are displayable in standalone documents
29+
// The svg backend module will strip the attribute during startup for inline display
2830
const {data} = optimize(await readFile(file, 'utf8'), {
2931
plugins: [
3032
{name: 'preset-default'},
31-
{name: 'removeXMLNS'},
3233
{name: 'removeDimensions'},
3334
{name: 'prefixIds', params: {prefix: () => name}},
3435
{name: 'addClassesToSVGElement', params: {classNames: ['svg', name]}},
35-
{name: 'addAttributesToSVGElement', params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]}},
36+
{
37+
name: 'addAttributesToSVGElement', params: {
38+
attributes: [
39+
{'xmlns': 'http://www.w3.org/2000/svg'},
40+
{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'},
41+
]
42+
}
43+
},
3644
],
3745
});
3846

build/test-echo.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
//go:build ignore
5+
6+
package main
7+
8+
import (
9+
"fmt"
10+
"io"
11+
"os"
12+
)
13+
14+
func main() {
15+
_, err := io.Copy(os.Stdout, os.Stdin)
16+
if err != nil {
17+
fmt.Fprintf(os.Stderr, "Error: %v", err)
18+
os.Exit(1)
19+
}
20+
}

build/update-locales.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,10 @@ fi
1717

1818
mv ./options/locale/locale_en-US.ini ./options/
1919

20-
# the "ini" library for locale has many quirks
21-
# * `a="xx"` gets `xx` (no quote)
22-
# * `a=x\"y` gets `x\"y` (no unescaping)
23-
# * `a="x\"y"` gets `"x\"y"` (no unescaping, the quotes are still there)
24-
# * `a='x\"y'` gets `x\"y` (no unescaping, no quote)
25-
# * `a="foo` gets `"foo` (although the quote is not closed)
26-
# * 'a=`foo`' works like single-quote
27-
# crowdin needs the strings to be quoted correctly and doesn't like incomplete quotes
28-
# crowdin always outputs quoted strings if there are quotes in the strings.
29-
30-
# this script helps to unquote the crowdin outputs for the quirky ini library
20+
# the "ini" library for locale has many quirks, its behavior is different from Crowdin.
21+
# see i18n_test.go for more details
22+
23+
# this script helps to unquote the Crowdin outputs for the quirky ini library
3124
# * find all `key="...\"..."` lines
3225
# * remove the leading quote
3326
# * remove the trailing quote
File renamed without changes.

cmd/dump.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ func runDump(ctx *cli.Context) error {
250250

251251
if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") {
252252
log.Info("Skip dumping LFS data")
253+
} else if !setting.LFS.StartServer {
254+
log.Info("LFS isn't enabled. Skip dumping LFS data")
253255
} else if err := storage.LFS.IterateObjects("", func(objPath string, object storage.Object) error {
254256
info, err := object.Stat()
255257
if err != nil {
@@ -364,6 +366,8 @@ func runDump(ctx *cli.Context) error {
364366

365367
if ctx.IsSet("skip-package-data") && ctx.Bool("skip-package-data") {
366368
log.Info("Skip dumping package data")
369+
} else if !setting.Packages.Enabled {
370+
log.Info("Packages isn't enabled. Skip dumping package data")
367371
} else if err := storage.Packages.IterateObjects("", func(objPath string, object storage.Object) error {
368372
info, err := object.Stat()
369373
if err != nil {

0 commit comments

Comments
 (0)