Skip to content

Commit e6447be

Browse files
author
Gusted
authored
Merge branch 'main' into enable-warning-notice
2 parents 4b92fb2 + 5bf8d54 commit e6447be

File tree

221 files changed

+2206
-1728
lines changed

Some content is hidden

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

221 files changed

+2206
-1728
lines changed

cmd/admin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
669669
log.Trace("Processing next %d repos of %d", len(repos), count)
670670
for _, repo := range repos {
671671
log.Trace("Synchronizing repo %s with path %s", repo.FullName(), repo.RepoPath())
672-
gitRepo, err := git.OpenRepository(repo.RepoPath())
672+
gitRepo, err := git.OpenRepositoryCtx(ctx, repo.RepoPath())
673673
if err != nil {
674674
log.Warn("OpenRepository: %v", err)
675675
continue

cmd/doctor.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package cmd
66

77
import (
8-
"context"
98
"fmt"
109
golog "log"
1110
"os"
@@ -116,7 +115,7 @@ func runRecreateTable(ctx *cli.Context) error {
116115
}
117116
recreateTables := migrations.RecreateTables(beans...)
118117

119-
return db.InitEngineWithMigration(context.Background(), func(x *xorm.Engine) error {
118+
return db.InitEngineWithMigration(stdCtx, func(x *xorm.Engine) error {
120119
if err := migrations.EnsureUpToDate(x); err != nil {
121120
return err
122121
}

cmd/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func runWeb(ctx *cli.Context) error {
8888
}
8989
defer func() {
9090
if panicked := recover(); panicked != nil {
91-
log.Fatal("PANIC: %v\n%s", panicked, string(log.Stack(2)))
91+
log.Fatal("PANIC: %v\n%s", panicked, log.Stack(2))
9292
}
9393
}()
9494

custom/conf/app.example.ini

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,26 +455,35 @@ APP_ID = ; e.g. http://localhost:3000/
455455
;; Use comma to separate multiple modes, e.g. "console, file"
456456
MODE = console
457457
;;
458-
;; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
458+
;; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical" or "None", default is "Info"
459459
LEVEL = Info
460460
;;
461461
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
462462
;; Router Logger
463463
;;
464464
;; Switch off the router log
465-
;DISABLE_ROUTER_LOG= ; false
465+
;DISABLE_ROUTER_LOG=false
466466
;;
467467
;; Set the log "modes" for the router log (if file is set the log file will default to router.log)
468468
ROUTER = console
469469
;;
470-
;; The level at which the router logs
471-
;ROUTER_LOG_LEVEL = Info
470+
;; The router will log different things at different levels.
472471
;;
472+
;; * started messages will be logged at TRACE level
473+
;; * polling/completed routers will be logged at INFO
474+
;; * slow routers will be logged at WARN
475+
;; * failed routers will be logged at WARN
476+
;;
477+
;; The routing level will default to that of the system but individual router level can be set in
478+
;; [log.<mode>.router] LEVEL
479+
;;
480+
473481
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
474482
;;
475483
;; Access Logger (Creates log in NCSA common log format)
476484
;;
477485
;ENABLE_ACCESS_LOG = false
486+
;;
478487
;; Set the log "modes" for the access log (if file is set the log file will default to access.log)
479488
;ACCESS = file
480489
;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ The following configuration set `Content-Type: application/vnd.android.package-a
291291
- `MINIMUM_KEY_SIZE_CHECK`: **true**: Indicate whether to check minimum key size with corresponding type.
292292

293293
- `OFFLINE_MODE`: **false**: Disables use of CDN for static files and Gravatar for profile pictures.
294-
- `DISABLE_ROUTER_LOG`: **false**: Mute printing of the router log.
295294
- `CERT_FILE`: **https/cert.pem**: Cert file path used for HTTPS. When chaining, the server certificate must come first, then intermediate CA certificates (if any). From 1.11 paths are relative to `CUSTOM_PATH`.
296295
- `KEY_FILE`: **https/key.pem**: Key file path used for HTTPS. From 1.11 paths are relative to `CUSTOM_PATH`.
297296
- `STATIC_ROOT_PATH`: **./**: Upper level of template and static files path.
@@ -752,11 +751,16 @@ Default templates for project boards:
752751
- `MODE`: **console**: Logging mode. For multiple modes, use a comma to separate values. You can configure each mode in per mode log subsections `\[log.modename\]`. By default the file mode will log to `$ROOT_PATH/gitea.log`.
753752
- `LEVEL`: **Info**: General log level. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
754753
- `STACKTRACE_LEVEL`: **None**: Default log level at which to log create stack traces. \[Trace, Debug, Info, Warn, Error, Critical, Fatal, None\]
755-
- `ROUTER_LOG_LEVEL`: **Info**: The log level that the router should log at. (If you are setting the access log, its recommended to place this at Debug.)
754+
- `ENABLE_SSH_LOG`: **false**: save ssh log to log file
755+
- `ENABLE_XORM_LOG`: **true**: Set whether to perform XORM logging. Please note SQL statement logging can be disabled by setting `LOG_SQL` to false in the `[database]` section.
756+
757+
### Router Log (`log`)
758+
- `DISABLE_ROUTER_LOG`: **false**: Mute printing of the router log.
756759
- `ROUTER`: **console**: The mode or name of the log the router should log to. (If you set this to `,` it will log to default Gitea logger.)
757-
NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
760+
NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take effect. Configure each mode in per mode log subsections `\[log.modename.router\]`.
761+
762+
### Access Log (`log`)
758763
- `ENABLE_ACCESS_LOG`: **false**: Creates an access.log in NCSA common log format, or as per the following template
759-
- `ENABLE_SSH_LOG`: **false**: save ssh log to log file
760764
- `ACCESS`: **file**: Logging mode for the access logger, use a comma to separate values. Configure each mode in per mode log subsections `\[log.modename.access\]`. By default the file mode will log to `$ROOT_PATH/access.log`. (If you set this to `,` it will log to the default Gitea logger.)
761765
- `ACCESS_LOG_TEMPLATE`: **`{{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"`**: Sets the template used to create the access log.
762766
- The following variables are available:
@@ -765,7 +769,6 @@ NB: You must have `DISABLE_ROUTER_LOG` set to `false` for this option to take ef
765769
- `Start`: the start time of the request.
766770
- `ResponseWriter`: the responseWriter from the request.
767771
- You must be very careful to ensure that this template does not throw errors or panics as this template runs outside of the panic/recovery script.
768-
- `ENABLE_XORM_LOG`: **true**: Set whether to perform XORM logging. Please note SQL statement logging can be disabled by setting `LOG_SQL` to false in the `[database]` section.
769772

770773
### Log subsections (`log.name`, `log.name.*`)
771774

docs/content/doc/advanced/logging-documentation.en-us.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,23 @@ multiple subloggers that will log to files.
6868

6969
### The "Router" logger
7070

71-
You can disable Router log by setting `DISABLE_ROUTER_LOG`.
71+
The Router logger has been substantially changed in v1.17. If you are using the router logger for fail2ban or other monitoring
72+
you will need to update this configuration.
73+
74+
You can disable Router log by setting `DISABLE_ROUTER_LOG` or by setting all of its sublogger configurations to `none`.
7275

7376
You can configure the outputs of this
7477
router log by setting the `ROUTER` value in the `[log]` section of the
75-
configuration. `ROUTER` will default to `console` if unset. The Gitea
76-
Router logs at the `Info` level by default, but this can be
77-
changed if desired by setting the `ROUTER_LOG_LEVEL` value.
78+
configuration. `ROUTER` will default to `console` if unset and will default to same level as main logger.
79+
80+
The Router logger logs the following:
81+
82+
- `started` messages will be logged at TRACE level
83+
- `polling`/`completed` routers will be logged at INFO
84+
- `slow` routers will be logged at WARN
85+
- `failed` routers will be logged at WARN
7886

79-
Please note, setting the `LEVEL` of this logger to a level above
80-
`ROUTER_LOG_LEVEL` will result in no router logs.
87+
The logging level for the router will default to that of the main configuration. Set `[log.<mode>.router]` `LEVEL` to change this.
8188

8289
Each output sublogger for this logger is configured in
8390
`[log.sublogger.router]` sections. There are certain default values

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/NYTimes/gziphandler v1.1.1
1717
github.com/ProtonMail/go-crypto v0.0.0-20210705153151-cc34b1f6908b // indirect
1818
github.com/PuerkitoBio/goquery v1.7.0
19-
github.com/alecthomas/chroma v0.9.4
19+
github.com/alecthomas/chroma v0.10.0
2020
github.com/andybalholm/brotli v1.0.3 // indirect
2121
github.com/andybalholm/cascadia v1.2.0 // indirect
2222
github.com/blevesearch/bleve/v2 v2.3.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4Rq
9494
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
9595
github.com/alecthomas/chroma v0.7.2-0.20200305040604-4f3623dce67a/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s=
9696
github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
97-
github.com/alecthomas/chroma v0.9.4 h1:YL7sOAE3p8HS96T9km7RgvmsZIctqbK1qJ0b7hzed44=
98-
github.com/alecthomas/chroma v0.9.4/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
97+
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
98+
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
9999
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
100100
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
101101
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=

integrations/api_repo_file_helpers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package integrations
77
import (
88
repo_model "code.gitea.io/gitea/models/repo"
99
user_model "code.gitea.io/gitea/models/user"
10+
"code.gitea.io/gitea/modules/git"
1011
api "code.gitea.io/gitea/modules/structs"
1112
files_service "code.gitea.io/gitea/services/repository/files"
1213
)
@@ -20,7 +21,7 @@ func createFileInBranch(user *user_model.User, repo *repo_model.Repository, tree
2021
Author: nil,
2122
Committer: nil,
2223
}
23-
return files_service.CreateOrUpdateRepoFile(repo, user, opts)
24+
return files_service.CreateOrUpdateRepoFile(git.DefaultContext, repo, user, opts)
2425
}
2526

2627
func createFile(user *user_model.User, repo *repo_model.Repository, treePath string) (*api.FileResponse, error) {

integrations/api_repo_get_contents_list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func testAPIGetContentsList(t *testing.T, u *url.URL) {
7272

7373
// Make a new branch in repo1
7474
newBranch := "test_branch"
75-
err := repo_service.CreateNewBranch(user2, repo1, repo1.DefaultBranch, newBranch)
75+
err := repo_service.CreateNewBranch(git.DefaultContext, user2, repo1, repo1.DefaultBranch, newBranch)
7676
assert.NoError(t, err)
7777
// Get the commit ID of the default branch
7878
gitRepo, err := git.OpenRepository(repo1.RepoPath())

0 commit comments

Comments
 (0)