Skip to content

Commit 28f689d

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (31 commits) Fix WORK_DIR for docker (root) image (go-gitea#25738) Avoid amending the Rebase and Fast-forward merge if there is no message template (go-gitea#25779) Show edit title button on commits tab of PR, too (go-gitea#25791) Make "install page" respect environment config (go-gitea#25648) Enable H014 and H023 djlint rules (go-gitea#25786) Restructure issue list template, styles (go-gitea#25750) Fix notification list bugs (go-gitea#25781) Revert package access change from go-gitea#23879 (go-gitea#25707) Make route middleware/handler mockable (go-gitea#25766) Update tool dependencies, lock govulncheck and actionlint (go-gitea#25655) Test if container blob is accessible before mounting (go-gitea#22759) Always pass 6-digit hex color to monaco (go-gitea#25780) Fix the wrong default branch name displayed by checkout (go-gitea#25777) Tweak repo topics bar (go-gitea#25769) docs: rootless docker ssh's default port is 2222 (go-gitea#25771) Repository Archived text title center align (go-gitea#25767) Update JS dependencies, misc tweaks (go-gitea#25768) Clarify "text-align" CSS helpers, fix clone button padding (go-gitea#25763) Switch to `vite-string-plugin` (go-gitea#25762) Newly pushed branches hints on repository home page (go-gitea#25715) ...
2 parents 55bdbdd + 5489962 commit 28f689d

File tree

188 files changed

+2828
-1668
lines changed

Some content is hidden

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

188 files changed

+2828
-1668
lines changed

.eslintrc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ plugins:
2222
- eslint-plugin-wc
2323

2424
env:
25-
es2022: true
25+
es2024: true
2626
node: true
2727

2828
overrides:
@@ -156,7 +156,7 @@ rules:
156156
import/no-restricted-paths: [0]
157157
import/no-self-import: [2]
158158
import/no-unassigned-import: [0]
159-
import/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$"]}]
159+
import/no-unresolved: [2, {commonjs: true, ignore: [\?.+$, ^vitest/]}]
160160
import/no-unused-modules: [2, {unusedExports: true}]
161161
import/no-useless-path-segments: [2, {commonjs: true}]
162162
import/no-webpack-loader-syntax: [2]
@@ -693,7 +693,7 @@ rules:
693693
unicorn/prefer-dom-node-remove: [2]
694694
unicorn/prefer-dom-node-text-content: [2]
695695
unicorn/prefer-event-target: [2]
696-
unicorn/prefer-export-from: [2, {ignoreUsedVariables: true}]
696+
unicorn/prefer-export-from: [0]
697697
unicorn/prefer-includes: [2]
698698
unicorn/prefer-json-parse-buffer: [0]
699699
unicorn/prefer-keyboard-event-key: [2]

.golangci.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,21 @@ linters-settings:
7777
extra-rules: true
7878
lang-version: "1.20"
7979
depguard:
80-
list-type: denylist
81-
# Check the list against standard lib.
82-
include-go-root: true
83-
packages-with-error-message:
84-
- encoding/json: "use gitea's modules/json instead of encoding/json"
85-
- github.com/unknwon/com: "use gitea's util and replacements"
86-
- io/ioutil: "use os or io instead"
87-
- golang.org/x/exp: "it's experimental and unreliable."
88-
- code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead"
89-
- gopkg.in/ini.v1: "do not use the ini package, use gitea's config system instead"
80+
rules:
81+
main:
82+
deny:
83+
- pkg: encoding/json
84+
desc: use gitea's modules/json instead of encoding/json
85+
- pkg: github.com/unknwon/com
86+
desc: use gitea's util and replacements
87+
- pkg: io/ioutil
88+
desc: use os or io instead
89+
- pkg: golang.org/x/exp
90+
desc: it's experimental and unreliable
91+
- pkg: code.gitea.io/gitea/modules/git/internal
92+
desc: do not use the internal package, use AddXxx function instead
93+
- pkg: gopkg.in/ini.v1
94+
desc: do not use the ini package, use gitea's config system instead
9095

9196
issues:
9297
max-issues-per-linter: 0

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ wxiaoguang <[email protected]> (@wxiaoguang)
5353
Gary Moon <[email protected]> (@garymoon)
5454
Philip Peterson <[email protected]> (@philip-peterson)
5555
Denys Konovalov <[email protected]> (@denyskon)
56+
Punit Inani <[email protected]> (@puni9869)

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ COMMA := ,
2525

2626
XGO_VERSION := go-1.20.x
2727

28-
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.43.0
28+
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.44.0
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
3030
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3
3232
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3333
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
34-
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected].4
34+
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected].5
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/[email protected]
37-
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
38-
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest
37+
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v0.2.0
38+
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.6.25
3939

4040
DOCKER_IMAGE ?= gitea/gitea
4141
DOCKER_TAG ?= latest

contrib/environment-to-ini/environment-to-ini.go

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ package main
55

66
import (
77
"os"
8-
"strings"
98

109
"code.gitea.io/gitea/modules/log"
1110
"code.gitea.io/gitea/modules/setting"
1211

1312
"github.com/urfave/cli"
1413
)
1514

16-
// EnvironmentPrefix environment variables prefixed with this represent ini values to write
17-
const EnvironmentPrefix = "GITEA"
18-
1915
func main() {
2016
app := cli.NewApp()
2117
app.Name = "environment-to-ini"
@@ -70,15 +66,6 @@ func main() {
7066
Value: "",
7167
Usage: "Destination file to write to",
7268
},
73-
cli.BoolFlag{
74-
Name: "clear",
75-
Usage: "Clears the matched variables from the environment",
76-
},
77-
cli.StringFlag{
78-
Name: "prefix, p",
79-
Value: EnvironmentPrefix,
80-
Usage: "Environment prefix to look for - will be suffixed by __ (2 underscores)",
81-
},
8269
}
8370
app.Action = runEnvironmentToIni
8471
err := app.Run(os.Args)
@@ -99,9 +86,7 @@ func runEnvironmentToIni(c *cli.Context) error {
9986
log.Fatal("Failed to load custom conf '%s': %v", setting.CustomConf, err)
10087
}
10188

102-
prefixGitea := c.String("prefix") + "__"
103-
suffixFile := "__FILE"
104-
changed := setting.EnvironmentToConfig(cfg, prefixGitea, suffixFile, os.Environ())
89+
changed := setting.EnvironmentToConfig(cfg, os.Environ())
10590

10691
// try to save the config file
10792
destination := c.String("out")
@@ -116,19 +101,5 @@ func runEnvironmentToIni(c *cli.Context) error {
116101
}
117102
}
118103

119-
// clear Gitea's specific environment variables if requested
120-
if c.Bool("clear") {
121-
for _, kv := range os.Environ() {
122-
idx := strings.IndexByte(kv, '=')
123-
if idx < 0 {
124-
continue
125-
}
126-
eKey := kv[:idx]
127-
if strings.HasPrefix(eKey, prefixGitea) {
128-
_ = os.Unsetenv(eKey)
129-
}
130-
}
131-
}
132-
133104
return nil
134105
}

docker/root/usr/local/bin/gitea

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
# And place the original in /usr/lib/gitea with working files in /data/gitea
1010
GITEA="/app/gitea/gitea"
11-
WORK_DIR="/app/gitea"
11+
WORK_DIR="/data/gitea"
1212
CUSTOM_PATH="/data/gitea"
1313

1414
# Provide docker defaults

docs/content/doc/installation/with-docker-rootless.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ services:
119119
- /etc/localtime:/etc/localtime:ro
120120
ports:
121121
- "3000:3000"
122-
- "222:22"
122+
- "2222:2222"
123123
+ depends_on:
124124
+ - db
125125
+
@@ -288,7 +288,7 @@ docker-compose up -d
288288

289289
In addition to the environment variables above, any settings in `app.ini` can be set
290290
or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`.
291-
These settings are applied each time the docker container starts.
291+
These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes.
292292
Full information [here](https://github.com/go-gitea/gitea/tree/main/contrib/environment-to-ini).
293293

294294
These environment variables can be passed to the docker container in `docker-compose.yml`.

docs/content/doc/installation/with-docker.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ docker-compose up -d
289289

290290
In addition to the environment variables above, any settings in `app.ini` can be set
291291
or overridden with an environment variable of the form: `GITEA__SECTION_NAME__KEY_NAME`.
292-
These settings are applied each time the docker container starts.
292+
These settings are applied each time the docker container starts, and won't be passed into Gitea's sub-processes.
293293
Full information [here](https://github.com/go-gitea/gitea/tree/master/contrib/environment-to-ini).
294294

295295
These environment variables can be passed to the docker container in `docker-compose.yml`.

models/activities/notification.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ func getIssueNotification(ctx context.Context, userID, issueID int64) (*Notifica
343343
// NotificationsForUser returns notifications for a given user and status
344344
func NotificationsForUser(ctx context.Context, user *user_model.User, statuses []NotificationStatus, page, perPage int) (notifications NotificationList, err error) {
345345
if len(statuses) == 0 {
346-
return
346+
return nil, nil
347347
}
348348

349349
sess := db.GetEngine(ctx).
@@ -372,16 +372,16 @@ func CountUnread(ctx context.Context, userID int64) int64 {
372372
// LoadAttributes load Repo Issue User and Comment if not loaded
373373
func (n *Notification) LoadAttributes(ctx context.Context) (err error) {
374374
if err = n.loadRepo(ctx); err != nil {
375-
return
375+
return err
376376
}
377377
if err = n.loadIssue(ctx); err != nil {
378-
return
378+
return err
379379
}
380380
if err = n.loadUser(ctx); err != nil {
381-
return
381+
return err
382382
}
383383
if err = n.loadComment(ctx); err != nil {
384-
return
384+
return err
385385
}
386386
return err
387387
}

models/asymkey/gpg_key_commit_verification.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,9 @@ func hashAndVerifyForKeyID(sig *packet.Signature, payload string, committer *use
455455

456456
// CalculateTrustStatus will calculate the TrustStatus for a commit verification within a repository
457457
// There are several trust models in Gitea
458-
func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, isOwnerMemberCollaborator func(*user_model.User) (bool, error), keyMap *map[string]bool) (err error) {
458+
func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_model.TrustModelType, isOwnerMemberCollaborator func(*user_model.User) (bool, error), keyMap *map[string]bool) error {
459459
if !verification.Verified {
460-
return
460+
return nil
461461
}
462462

463463
// In the Committer trust model a signature is trusted if it matches the committer
@@ -475,7 +475,7 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
475475
verification.SigningUser.Email == verification.CommittingUser.Email) {
476476
verification.TrustStatus = "trusted"
477477
}
478-
return
478+
return nil
479479
}
480480

481481
// Now we drop to the more nuanced trust models...
@@ -490,10 +490,11 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
490490
verification.SigningUser.Email != verification.CommittingUser.Email) {
491491
verification.TrustStatus = "untrusted"
492492
}
493-
return
493+
return nil
494494
}
495495

496496
// Check we actually have a GPG SigningKey
497+
var err error
497498
if verification.SigningKey != nil {
498499
var isMember bool
499500
if keyMap != nil {

0 commit comments

Comments
 (0)