Skip to content

Commit 25f6156

Browse files
authored
Merge branch 'main' into uprof
2 parents 3965c69 + e62ea96 commit 25f6156

File tree

135 files changed

+1530
-1037
lines changed

Some content is hidden

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

135 files changed

+1530
-1037
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@ 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.20.1](https://github.com/go-gitea/gitea/releases/tag/1.20.1) - 2023-07-22
8+
9+
* SECURITY
10+
* Disallow dangerous URL schemes (#25960) (#25964)
11+
* ENHANCEMENTS
12+
* Show the mismatched ROOT_URL warning on the sign-in page if OAuth2 is enabled (#25947) (#25972)
13+
* Make pending commit status yellow again (#25935) (#25968)
14+
* BUGFIXES
15+
* Fix version in rpm repodata/primary.xml.gz (#26009) (#26048)
16+
* Fix env config parsing for "GITEA____APP_NAME" (#26001) (#26013)
17+
* ParseScope with owner/repo always sets owner to zero (#25987) (#25989)
18+
* Fix SSPI auth panic (#25955) (#25969)
19+
* Avoid creating directories when loading config (#25944) (#25957)
20+
* Make environment-to-ini work with INSTALL_LOCK=true (#25926) (#25937)
21+
* Ignore `runs-on` with expressions when warning no matched runners (#25917) (#25933)
22+
* Avoid opening/closing PRs which are already merged (#25883) (#25903)
23+
* DOCS
24+
* RPM Registry: Show zypper commands for SUSE based distros as well (#25981) (#26020)
25+
* Correctly refer to dev tags as nightly in the docker docs (#26004) (#26019)
26+
* Update path related documents (#25417) (#25982)
27+
* MISC
28+
* Adding remaining enum for migration repo model type. (#26021) (#26034)
29+
* Fix the route for pull-request's authors (#26016) (#26018)
30+
* Fix commit status color on dashboard repolist (#25993) (#25998)
31+
* Avoid hard-coding height in language dropdown menu (#25986) (#25997)
32+
* Add shutting down notice (#25920) (#25922)
33+
* Fix incorrect milestone count when provide a keyword (#25880) (#25904)
34+
735
## [1.20.0](https://github.com/go-gitea/gitea/releases/tag/v1.20.0) - 2023-07-16
836

937
* BREAKING

assets/go-licenses.json

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

cmd/admin.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package cmd
66

77
import (
8+
"context"
89
"errors"
910
"fmt"
1011
"net/url"
@@ -297,10 +298,12 @@ var (
297298
&cli.BoolFlag{
298299
Name: "force-smtps",
299300
Usage: "SMTPS is always used on port 465. Set this to force SMTPS on other ports.",
301+
Value: true,
300302
},
301303
&cli.BoolFlag{
302304
Name: "skip-verify",
303305
Usage: "Skip TLS verify.",
306+
Value: true,
304307
},
305308
&cli.StringFlag{
306309
Name: "helo-hostname",
@@ -310,6 +313,7 @@ var (
310313
&cli.BoolFlag{
311314
Name: "disable-helo",
312315
Usage: "Disable SMTP helo.",
316+
Value: true,
313317
},
314318
&cli.StringFlag{
315319
Name: "allowed-domains",
@@ -319,10 +323,12 @@ var (
319323
&cli.BoolFlag{
320324
Name: "skip-local-2fa",
321325
Usage: "Skip 2FA to log on.",
326+
Value: true,
322327
},
323328
&cli.BoolFlag{
324329
Name: "active",
325330
Usage: "This Authentication Source is Activated.",
331+
Value: true,
326332
},
327333
}
328334

@@ -373,7 +379,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
373379
continue
374380
}
375381

376-
oldnum, err := getReleaseCount(repo.ID)
382+
oldnum, err := getReleaseCount(ctx, repo.ID)
377383
if err != nil {
378384
log.Warn(" GetReleaseCountByRepoID: %v", err)
379385
}
@@ -385,7 +391,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
385391
continue
386392
}
387393

388-
count, err = getReleaseCount(repo.ID)
394+
count, err = getReleaseCount(ctx, repo.ID)
389395
if err != nil {
390396
log.Warn(" GetReleaseCountByRepoID: %v", err)
391397
gitRepo.Close()
@@ -401,9 +407,9 @@ func runRepoSyncReleases(_ *cli.Context) error {
401407
return nil
402408
}
403409

404-
func getReleaseCount(id int64) (int64, error) {
410+
func getReleaseCount(ctx context.Context, id int64) (int64, error) {
405411
return repo_model.GetReleaseCountByRepoID(
406-
db.DefaultContext,
412+
ctx,
407413
id,
408414
repo_model.FindReleasesOptions{
409415
IncludeTags: true,

cmd/doctor.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@ import (
2222
"xorm.io/xorm"
2323
)
2424

25-
// CmdDoctor represents the available doctor sub-command.
26-
var CmdDoctor = &cli.Command{
27-
Name: "doctor",
25+
var cmdDoctorCheck = &cli.Command{
26+
Name: "check",
2827
Usage: "Diagnose and optionally fix problems",
2928
Description: "A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
30-
Action: runDoctor,
29+
Action: runDoctorCheck,
3130
Flags: []cli.Flag{
3231
&cli.BoolFlag{
3332
Name: "list",
@@ -51,16 +50,26 @@ var CmdDoctor = &cli.Command{
5150
},
5251
&cli.StringFlag{
5352
Name: "log-file",
54-
Usage: `Name of the log file (default: "doctor.log"). Set to "-" to output to stdout, set to "" to disable`,
53+
Usage: `Name of the log file (no verbose log output by default). Set to "-" to output to stdout`,
5554
},
5655
&cli.BoolFlag{
5756
Name: "color",
5857
Aliases: []string{"H"},
5958
Usage: "Use color for outputted information",
6059
},
6160
},
61+
}
62+
63+
// CmdDoctor represents the available doctor sub-command.
64+
var CmdDoctor = &cli.Command{
65+
Name: "doctor",
66+
Usage: "Diagnose and optionally fix problems",
67+
Description: "A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
68+
6269
Subcommands: []*cli.Command{
70+
cmdDoctorCheck,
6371
cmdRecreateTable,
72+
cmdDoctorConvert,
6473
},
6574
}
6675

@@ -133,16 +142,9 @@ func setupDoctorDefaultLogger(ctx *cli.Context, colorize bool) {
133142
setupConsoleLogger(log.FATAL, log.CanColorStderr, os.Stderr)
134143

135144
logFile := ctx.String("log-file")
136-
if !ctx.IsSet("log-file") {
137-
logFile = "doctor.log"
138-
}
139-
140-
if len(logFile) == 0 {
141-
// if no doctor log-file is set, do not show any log from default logger
142-
return
143-
}
144-
145-
if logFile == "-" {
145+
if logFile == "" {
146+
return // if no doctor log-file is set, do not show any log from default logger
147+
} else if logFile == "-" {
146148
setupConsoleLogger(log.TRACE, colorize, os.Stdout)
147149
} else {
148150
logFile, _ = filepath.Abs(logFile)
@@ -156,7 +158,7 @@ func setupDoctorDefaultLogger(ctx *cli.Context, colorize bool) {
156158
}
157159
}
158160

159-
func runDoctor(ctx *cli.Context) error {
161+
func runDoctorCheck(ctx *cli.Context) error {
160162
stdCtx, cancel := installSignals()
161163
defer cancel()
162164

cmd/convert.go renamed to cmd/doctor_convert.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import (
1313
"github.com/urfave/cli/v2"
1414
)
1515

16-
// CmdConvert represents the available convert sub-command.
17-
var CmdConvert = &cli.Command{
16+
// cmdDoctorConvert represents the available convert sub-command.
17+
var cmdDoctorConvert = &cli.Command{
1818
Name: "convert",
1919
Usage: "Convert the database",
2020
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
21-
Action: runConvert,
21+
Action: runDoctorConvert,
2222
}
2323

24-
func runConvert(ctx *cli.Context) error {
24+
func runDoctorConvert(ctx *cli.Context) error {
2525
stdCtx, cancel := installSignals()
2626
defer cancel()
2727

cmd/main.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"code.gitea.io/gitea/modules/log"
1313
"code.gitea.io/gitea/modules/setting"
14+
"code.gitea.io/gitea/modules/util"
1415

1516
"github.com/urfave/cli/v2"
1617
)
@@ -23,9 +24,13 @@ func cmdHelp() *cli.Command {
2324
Usage: "Shows a list of commands or help for one command",
2425
ArgsUsage: "[command]",
2526
Action: func(c *cli.Context) (err error) {
26-
args := c.Args()
27-
if args.Present() {
28-
err = cli.ShowCommandHelp(c, args.First())
27+
lineage := c.Lineage() // The order is from child to parent: help, doctor, Gitea, {Command:nil}
28+
targetCmdIdx := 0
29+
if c.Command.Name == "help" {
30+
targetCmdIdx = 1
31+
}
32+
if lineage[targetCmdIdx+1].Command != nil {
33+
err = cli.ShowCommandHelp(lineage[targetCmdIdx+1], lineage[targetCmdIdx].Command.Name)
2934
} else {
3035
err = cli.ShowAppHelp(c)
3136
}
@@ -94,9 +99,8 @@ func prepareSubcommandWithConfig(command *cli.Command, globalFlags []cli.Flag) {
9499
func prepareWorkPathAndCustomConf(action cli.ActionFunc) func(ctx *cli.Context) error {
95100
return func(ctx *cli.Context) error {
96101
var args setting.ArgWorkPathAndCustomConf
97-
ctxLineage := ctx.Lineage()
98-
for i := len(ctxLineage) - 1; i >= 0; i-- {
99-
curCtx := ctxLineage[i]
102+
// from children to parent, check the global flags
103+
for _, curCtx := range ctx.Lineage() {
100104
if curCtx.IsSet("work-path") && args.WorkPath == "" {
101105
args.WorkPath = curCtx.String("work-path")
102106
}
@@ -159,7 +163,6 @@ func NewMainApp() *cli.App {
159163
CmdAdmin,
160164
CmdMigrate,
161165
CmdKeys,
162-
CmdConvert,
163166
CmdDoctor,
164167
CmdManager,
165168
CmdEmbedded,
@@ -170,6 +173,10 @@ func NewMainApp() *cli.App {
170173
cmdHelp(), // the "help" sub-command was used to show the more information for "work path" and "custom config"
171174
}
172175

176+
cmdConvert := util.ToPointer(*cmdDoctorConvert)
177+
cmdConvert.Hidden = true // still support the legacy "./gitea doctor" by the hidden sub-command, remove it in next release
178+
subCmdWithConfig = append(subCmdWithConfig, cmdConvert)
179+
173180
// these sub-commands do not need the config file, and they do not depend on any path or environment variable.
174181
subCmdStandalone := []*cli.Command{
175182
CmdCert,

cmd/manager_logging.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ var (
117117
Name: "rotate",
118118
Aliases: []string{"r"},
119119
Usage: "Rotate logs",
120+
Value: true,
120121
},
121122
&cli.Int64Flag{
122123
Name: "max-size",
@@ -127,6 +128,7 @@ var (
127128
Name: "daily",
128129
Aliases: []string{"d"},
129130
Usage: "Rotate logs daily",
131+
Value: true,
130132
},
131133
&cli.IntFlag{
132134
Name: "max-days",
@@ -137,6 +139,7 @@ var (
137139
Name: "compress",
138140
Aliases: []string{"z"},
139141
Usage: "Compress rotated logs",
142+
Value: true,
140143
},
141144
&cli.IntFlag{
142145
Name: "compression-level",

docs/content/doc/administration/command-line.en-us.md

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -388,35 +388,18 @@ NB: Gitea must be running for this command to succeed.
388388
Migrates the database. This command can be used to run other commands before starting the server for the first time.
389389
This command is idempotent.
390390

391-
### convert
391+
### doctor check
392392

393-
Converts an existing MySQL database from utf8 to utf8mb4.
393+
Diagnose and potentially fix problems with the current Gitea instance.
394+
Several checks are run by default, but additional ones can be run:
394395

395-
### doctor
396+
- `gitea doctor check --list` - will list all the available checks
397+
- `gitea doctor check --all` - will run all available checks
398+
- `gitea doctor check --default` - will run the default checks
399+
- `gitea doctor check --run [check(s),]...` - will run the named checks
396400

397-
Diagnose the problems of current Gitea instance according the given configuration.
398-
Currently there are a check list below:
399-
400-
- Check if OpenSSH authorized_keys file id correct
401-
When your Gitea instance support OpenSSH, your Gitea instance binary path will be written to `authorized_keys`
402-
when there is any public key added or changed on your Gitea instance.
403-
Sometimes if you moved or renamed your Gitea binary when upgrade and you haven't run `Update the '.ssh/authorized_keys' file with Gitea SSH keys. (Not needed for the built-in SSH server.)` on your Admin Panel. Then all pull/push via SSH will not be work.
404-
This check will help you to check if it works well.
405-
406-
For contributors, if you want to add more checks, you can write a new function like `func(ctx *cli.Context) ([]string, error)` and
407-
append it to `doctor.go`.
408-
409-
```go
410-
var checklist = []check{
411-
{
412-
title: "Check if OpenSSH authorized_keys file id correct",
413-
f: runDoctorLocationMoved,
414-
},
415-
// more checks please append here
416-
}
417-
```
418-
419-
This function will receive a command line context and return a list of details about the problems or error.
401+
Some problems can be automatically fixed by passing the `--fix` option.
402+
Extra logging can be set with `--log-file=...`.
420403

421404
#### doctor recreate-table
422405

@@ -448,6 +431,10 @@ gitea doctor recreate-table
448431

449432
It is highly recommended to back-up your database before running these commands.
450433

434+
### doctor convert
435+
436+
Converts a MySQL database from utf8 to utf8mb4 or a MSSQL database from varchar to nvarchar.
437+
451438
### manager
452439

453440
Manage running server operations:

0 commit comments

Comments
 (0)