Skip to content

Commit 91f2f02

Browse files
author
Earl Warren
committed
Merge pull request '[gitea] cherry-pick' (go-gitea#2320) from earl-warren/forgejo:wip-gitea-cherry-pick into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2320
2 parents a4ca473 + 22c694a commit 91f2f02

39 files changed

+264
-535
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ rules:
811811
wc/no-constructor-params: [2]
812812
wc/no-constructor: [2]
813813
wc/no-customized-built-in-elements: [2]
814-
wc/no-exports-with-element: [2]
814+
wc/no-exports-with-element: [0]
815815
wc/no-invalid-element-name: [2]
816816
wc/no-invalid-extends: [2]
817817
wc/no-method-prefixed-with-on: [2]

Makefile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-che
3131
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
3232
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected]
3333
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
34-
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
34+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.4.1
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
3636
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3737
GO_LICENSES_PACKAGE ?= github.com/google/[email protected]
@@ -134,6 +134,8 @@ TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMAN
134134
GO_DIRS := build cmd models modules routers services tests
135135
WEB_DIRS := web_src/js web_src/css
136136

137+
SPELLCHECK_FILES := $(GO_DIRS) $(WEB_DIRS) docs/content templates options/locale/locale_en-US.ini .github
138+
137139
GO_SOURCES := $(wildcard *.go)
138140
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" ! -path modules/options/bindata.go ! -path modules/public/bindata.go ! -path modules/templates/bindata.go)
139141
GO_SOURCES += $(GENERATED_GO_DEST)
@@ -212,6 +214,8 @@ help:
212214
@echo " - lint-swagger lint swagger files"
213215
@echo " - lint-templates lint template files"
214216
@echo " - lint-yaml lint yaml files"
217+
@echo " - lint-spell lint spelling"
218+
@echo " - lint-spell-fix lint spelling and fix issues"
215219
@echo " - checks run various consistency checks"
216220
@echo " - checks-frontend check frontend files"
217221
@echo " - checks-backend check backend files"
@@ -303,10 +307,6 @@ fmt-check: fmt
303307
exit 1; \
304308
fi
305309

306-
.PHONY: misspell-check
307-
misspell-check:
308-
go run $(MISSPELL_PACKAGE) -error $(GO_DIRS) $(WEB_DIRS)
309-
310310
.PHONY: $(TAGS_EVIDENCE)
311311
$(TAGS_EVIDENCE):
312312
@mkdir -p $(MAKE_EVIDENCE_DIR)
@@ -368,13 +368,13 @@ checks: checks-frontend checks-backend
368368
checks-frontend: lockfile-check svg-check
369369

370370
.PHONY: checks-backend
371-
checks-backend: tidy-check swagger-check fmt-check misspell-check forgejo-api-validate swagger-validate security-check
371+
checks-backend: tidy-check swagger-check fmt-check swagger-validate security-check
372372

373373
.PHONY: lint
374-
lint: lint-frontend lint-backend
374+
lint: lint-frontend lint-backend lint-spell
375375

376376
.PHONY: lint-fix
377-
lint-fix: lint-frontend-fix lint-backend-fix
377+
lint-fix: lint-frontend-fix lint-backend-fix lint-spell-fix
378378

379379
.PHONY: lint-frontend
380380
lint-frontend: lint-js lint-css
@@ -412,6 +412,14 @@ lint-swagger: node_modules
412412
lint-md: node_modules
413413
npx markdownlint docs *.md
414414

415+
.PHONY: lint-spell
416+
lint-spell:
417+
@go run $(MISSPELL_PACKAGE) -error $(SPELLCHECK_FILES)
418+
419+
.PHONY: lint-spell-fix
420+
lint-spell-fix:
421+
@go run $(MISSPELL_PACKAGE) -w $(SPELLCHECK_FILES)
422+
415423
.PHONY: lint-go
416424
lint-go:
417425
$(GO) run $(GOLANGCI_LINT_PACKAGE) run $(GOLANGCI_LINT_ARGS)

cmd/serv.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,18 @@ func runServ(c *cli.Context) error {
216216
}
217217
}
218218

219-
// LowerCase and trim the repoPath as that's how they are stored.
220-
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
221-
222219
rr := strings.SplitN(repoPath, "/", 2)
223220
if len(rr) != 2 {
224221
return fail(ctx, "Invalid repository path", "Invalid repository path: %v", repoPath)
225222
}
226223

227-
username := strings.ToLower(rr[0])
228-
reponame := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
224+
username := rr[0]
225+
reponame := strings.TrimSuffix(rr[1], ".git")
226+
227+
// LowerCase and trim the repoPath as that's how they are stored.
228+
// This should be done after splitting the repoPath into username and reponame
229+
// so that username and reponame are not affected.
230+
repoPath = strings.ToLower(strings.TrimSpace(repoPath))
229231

230232
if alphaDashDotPattern.MatchString(reponame) {
231233
return fail(ctx, "Invalid repo name", "Invalid repo name: %s", reponame)

docs/content/administration/config-cheat-sheet.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ menu:
2929
[ini](https://github.com/go-ini/ini/#recursive-values) 这里的说明。
3030
标注了 :exclamation: 的配置项表明除非你真的理解这个配置项的意义,否则最好使用默认值。
3131

32-
在下面的默认值中,`$XYZ`代表环境变量`XYZ`的值(详见:`enviroment-to-ini`)。 _`XxYyZz`_是指默认配置的一部分列出的值。这些在 app.ini 文件中不起作用,仅在此处列出作为文档说明。
32+
在下面的默认值中,`$XYZ`代表环境变量`XYZ`的值(详见:`environment-to-ini`)。 _`XxYyZz`_是指默认配置的一部分列出的值。这些在 app.ini 文件中不起作用,仅在此处列出作为文档说明。
3333

3434
包含`#`或者`;`的变量必须使用引号(`` ` ``或者`""""`)包裹,否则会被解析为注释。
3535

docs/content/development/hacking-on-gitea.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ documentation using:
243243
make generate-swagger
244244
```
245245

246-
You should validate your generated Swagger file and spell-check it with:
246+
You should validate your generated Swagger file:
247247

248248
```bash
249-
make swagger-validate misspell-check
249+
make swagger-validate
250250
```
251251

252252
You should commit the changed swagger JSON file. The continuous integration

docs/content/development/hacking-on-gitea.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ Gitea Logo的 PNG 和 SVG 版本是使用 `TAGS="gitea" make generate-images`
228228
make generate-swagger
229229
```
230230

231-
您应该验证生成的 Swagger 文件并使用以下命令对其进行拼写检查
231+
您应该验证生成的 Swagger 文件
232232

233233
```bash
234-
make swagger-validate misspell-check
234+
make swagger-validate
235235
```
236236

237237
您应该提交更改后的 swagger JSON 文件。持续集成服务器将使用以下方法检查是否已完成:

docs/content/installation/from-source.en-us.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ Next, [install Node.js with npm](https://nodejs.org/en/download/) which is
2727
required to build the JavaScript and CSS files. The minimum supported Node.js
2828
version is @minNodeVersion@ and the latest LTS version is recommended.
2929

30-
**Note**: When executing make tasks that require external tools, like
31-
`make misspell-check`, Gitea will automatically download and build these as
32-
necessary. To be able to use these, you must have the `"$GOPATH/bin"` directory
33-
on the executable path. If you don't add the go bin directory to the
34-
executable path, you will have to manage this yourself.
35-
36-
**Note 2**: Go version @minGoVersion@ or higher is required. However, it is recommended to
30+
**Note**: Go version @minGoVersion@ or higher is required. However, it is recommended to
3731
obtain the same version as our continuous integration, see the advice given in
3832
[Hacking on Gitea](development/hacking-on-gitea.md)
3933

docs/content/installation/from-source.zh-cn.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ menu:
2121

2222
接下来,[安装 Node.js 和 npm](https://nodejs.org/zh-cn/download/), 这是构建 JavaScript 和 CSS 文件所需的。最低支持的 Node.js 版本是 @minNodeVersion@,建议使用最新的 LTS 版本。
2323

24-
**注意**:当执行需要外部工具的 make 任务(如`make misspell-check`)时,Gitea 将根据需要自动下载和构建这些工具。为了能够实现这个目的,你必须将`"$GOPATH/bin"`目录添加到可执行路径中。如果没有将 Go 的二进制目录添加到可执行路径中,你需要自行解决产生的问题。
25-
26-
**注意2**:需要 Go 版本 @minGoVersion@ 或更高版本。不过,建议获取与我们的持续集成(continuous integration, CI)相同的版本,请参阅在 [Hacking on Gitea](development/hacking-on-gitea.md) 中给出的建议。
24+
**注意**:需要 Go 版本 @minGoVersion@ 或更高版本。不过,建议获取与我们的持续集成(continuous integration, CI)相同的版本,请参阅在 [Hacking on Gitea](development/hacking-on-gitea.md) 中给出的建议。
2725

2826
## 下载
2927

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The following package managers are currently supported:
4242
| [PyPI](usage/packages/pypi.md) | Python | `pip`, `twine` |
4343
| [RPM](usage/packages/rpm.md) | - | `yum`, `dnf`, `zypper` |
4444
| [RubyGems](usage/packages/rubygems.md) | Ruby | `gem`, `Bundler` |
45-
| [Swift](usage/packages/rubygems.md) | Swift | `swift` |
45+
| [Swift](usage/packages/swift.md) | Swift | `swift` |
4646
| [Vagrant](usage/packages/vagrant.md) | - | `vagrant` |
4747

4848
**The following paragraphs only apply if Packages are not globally disabled!**

docs/content/usage/packages/swift.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ To work with the Swift package registry, you need to use [swift](https://www.swi
2626
To register the package registry and provide credentials, execute:
2727

2828
```shell
29-
swift package-registry set https://gitea.example.com/api/packages/{owner}/swift -login {username} -password {password}
29+
swift package-registry set https://gitea.example.com/api/packages/{owner}/swift
30+
swift package-registry login https://gitea.example.com/api/packages/{owner}/swift --username {username} --password {password}
3031
```
3132

3233
| Placeholder | Description |

0 commit comments

Comments
 (0)