Skip to content

Commit fbad930

Browse files
authored
Merge branch 'main' into lunny/upgrade_certmanager
2 parents a77d26e + c99b8ef commit fbad930

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ One of these three distributions of Make will run on Windows:
7373
- MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software, it includes MinGW-w64.
7474
- In MingGW-w64, the binary is called `mingw32-make.exe` instead of `make.exe`. Add the `bin` folder to `PATH`.
7575
- In MSYS2, you can use `make` directly. See [MSYS2 Porting](https://www.msys2.org/wiki/Porting/).
76+
- To compile Gitea with CGO_ENABLED (eg: SQLite3), you might need to use [tdm-gcc](https://jmeubank.github.io/tdm-gcc/) instead of MSYS2 gcc, because MSYS2 gcc headers lack some Windows-only CRT functions like `_beginthread`.
7677
- [Chocolatey package](https://chocolatey.org/packages/make). Run `choco install make`
7778

7879
**Note**: If you are attempting to build using make with Windows Command Prompt, you may run into issues. The above prompts (Git bash, or MinGW) are recommended, however if you only have command prompt (or potentially PowerShell) you can set environment variables using the [set](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1) command, e.g. `set TAGS=bindata`.
@@ -273,10 +274,17 @@ make test-sqlite-migration # with SQLite switched for the appropriate database
273274

274275
There are two types of test run by Gitea: Unit tests and Integration Tests.
275276

277+
### Unit Tests
278+
279+
Unit tests are covered by `*_test.go` in `go test` system.
280+
You can set environment variable `GITEA_UNIT_TESTS_VERBOSE=1` to see detail logs during the test.
281+
276282
```bash
277283
TAGS="bindata sqlite sqlite_unlock_notify" make test # Runs the unit tests
278284
```
279285

286+
### Integration Tests
287+
280288
Unit tests will not and cannot completely test Gitea alone. Therefore, we
281289
have written integration tests; however, these are database dependent.
282290

@@ -288,10 +296,12 @@ will run the integration tests in an SQLite environment. Integration tests
288296
require `git lfs` to be installed. Other database tests are available but
289297
may need adjustment to the local environment.
290298

291-
Look at
292-
[`integrations/README.md`](https://github.com/go-gitea/gitea/blob/main/integrations/README.md)
299+
Take a look at [`integrations/README.md`](https://github.com/go-gitea/gitea/blob/main/integrations/README.md)
293300
for more information and how to run a single test.
294301

302+
303+
### Testing for a PR
304+
295305
Our continuous integration will test the code passes its unit tests and that
296306
all supported databases will pass integration test in a Docker environment.
297307
Migration from several recent versions of Gitea will also be tested.

routers/web/repo/migrate.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ func handleMigrateError(ctx *context.Context, owner *user_model.User, err error,
8181
case migrations.IsTwoFactorAuthError(err):
8282
ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form)
8383
case repo_model.IsErrReachLimitOfRepo(err):
84-
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
84+
var msg string
85+
maxCreationLimit := ctx.User.MaxCreationLimit()
86+
if maxCreationLimit == 1 {
87+
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
88+
} else {
89+
msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)
90+
}
91+
ctx.RenderWithErr(msg, tpl, form)
8592
case repo_model.IsErrRepoAlreadyExist(err):
8693
ctx.Data["Err_RepoName"] = true
8794
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)

routers/web/repo/repo.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,14 @@ func Create(ctx *context.Context) {
162162
func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl base.TplName, form interface{}) {
163163
switch {
164164
case repo_model.IsErrReachLimitOfRepo(err):
165-
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
165+
var msg string
166+
maxCreationLimit := ctx.User.MaxCreationLimit()
167+
if maxCreationLimit == 1 {
168+
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
169+
} else {
170+
msg = ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit)
171+
}
172+
ctx.RenderWithErr(msg, tpl, form)
166173
case repo_model.IsErrRepoAlreadyExist(err):
167174
ctx.Data["Err_RepoName"] = true
168175
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)

routers/web/repo/setting.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,12 @@ func SettingsPost(ctx *context.Context) {
609609
}
610610

611611
if !ctx.Repo.Owner.CanCreateRepo() {
612-
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation", ctx.User.MaxCreationLimit()))
612+
maxCreationLimit := ctx.User.MaxCreationLimit()
613+
if maxCreationLimit == 1 {
614+
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
615+
} else {
616+
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_n", maxCreationLimit))
617+
}
613618
ctx.Redirect(repo.Link() + "/settings")
614619
return
615620
}

services/pull/patch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ func checkConflicts(pr *models.PullRequest, gitRepo *git.Repository, tmpBasePath
235235
}()
236236

237237
numberOfConflicts := 0
238+
pr.ConflictedFiles = make([]string, 0, 5)
238239
conflict := false
239240

240241
for file := range unmerged {

0 commit comments

Comments
 (0)