浏览代码

Merge branch 'main' into lunny/rename_board_column

pull/30170/head
Lunny Xiao 1 个月前
父节点
当前提交
d065f6ffc3
共有 100 个文件被更改,包括 402 次插入277 次删除
  1. 4
    4
      .eslintrc.yaml
  2. 32
    23
      .golangci.yml
  3. 5
    5
      assets/go-licenses.json
  4. 2
    1
      cmd/admin_auth.go
  5. 2
    1
      cmd/admin_auth_oauth.go
  6. 1
    2
      cmd/admin_auth_stmp.go
  7. 2
    1
      cmd/admin_user_delete.go
  8. 3
    2
      cmd/admin_user_generate_access_token.go
  9. 34
    24
      cmd/dump.go
  10. 3
    3
      cmd/embedded.go
  11. 1
    1
      cmd/hook.go
  12. 2
    1
      cmd/manager_logging.go
  13. 1
    2
      go.mod
  14. 2
    4
      go.sum
  15. 24
    2
      models/actions/runner.go
  16. 0
    1
      models/asymkey/gpg_key_commit_verification.go
  17. 2
    1
      models/auth/oauth2.go
  18. 0
    2
      models/auth/oauth2_test.go
  19. 0
    1
      models/db/engine.go
  20. 2
    2
      models/git/lfs_lock.go
  21. 0
    2
      models/issues/review.go
  22. 0
    5
      models/migrations/base/db.go
  23. 0
    0
      models/migrations/fixtures/Test_AddConfidentialClientColumnToOAuth2ApplicationTable/oauth2_application.yml
  24. 2
    0
      models/migrations/migrations.go
  25. 0
    2
      models/migrations/v1_11/v111.go
  26. 3
    3
      models/migrations/v1_18/v230.go
  27. 3
    3
      models/migrations/v1_18/v230_test.go
  28. 2
    2
      models/migrations/v1_20/v250.go
  29. 10
    0
      models/migrations/v1_23/v298.go
  30. 0
    1
      models/migrations/v1_6/v71.go
  31. 0
    1
      models/migrations/v1_9/v85.go
  32. 2
    2
      models/org_team.go
  33. 1
    2
      models/organization/team.go
  34. 11
    11
      models/packages/package_version.go
  35. 4
    4
      models/perm/access/access_test.go
  36. 37
    19
      models/perm/access/repo_permission.go
  37. 41
    3
      models/perm/access/repo_permission_test.go
  38. 0
    1
      models/repo/user_repo.go
  39. 2
    1
      models/repo_transfer.go
  40. 1
    2
      models/user/user.go
  41. 6
    6
      modules/auth/password/password.go
  42. 3
    3
      modules/git/batch_reader.go
  43. 1
    1
      modules/git/commit.go
  44. 1
    2
      modules/git/commit_reader.go
  45. 0
    1
      modules/git/pipeline/lfs_nogogit.go
  46. 4
    4
      modules/git/repo_commit.go
  47. 0
    1
      modules/git/submodule.go
  48. 0
    2
      modules/indexer/code/bleve/bleve.go
  49. 2
    2
      modules/indexer/issues/dboptions.go
  50. 0
    1
      modules/indexer/issues/elasticsearch/elasticsearch.go
  51. 0
    1
      modules/log/event_format.go
  52. 0
    2
      modules/markup/markdown/markdown_test.go
  53. 16
    16
      modules/packages/rubygems/marshal.go
  54. 0
    1
      modules/process/manager_stacktraces.go
  55. 11
    7
      modules/queue/workergroup.go
  56. 0
    2
      modules/queue/workerqueue.go
  57. 23
    10
      modules/queue/workerqueue_test.go
  58. 0
    1
      modules/repository/temp.go
  59. 1
    2
      modules/setting/time.go
  60. 2
    3
      modules/templates/htmlrenderer.go
  61. 1
    2
      modules/templates/mailer.go
  62. 3
    3
      modules/util/util_test.go
  63. 13
    7
      modules/web/handler.go
  64. 10
    0
      options/license/HPND-UC-export-US
  65. 32
    0
      options/license/NCL
  66. 0
    1
      options/locale/locale_cs-CZ.ini
  67. 0
    1
      options/locale/locale_de-DE.ini
  68. 0
    1
      options/locale/locale_el-GR.ini
  69. 0
    1
      options/locale/locale_en-US.ini
  70. 0
    1
      options/locale/locale_es-ES.ini
  71. 0
    1
      options/locale/locale_fa-IR.ini
  72. 0
    1
      options/locale/locale_fi-FI.ini
  73. 0
    1
      options/locale/locale_fr-FR.ini
  74. 0
    1
      options/locale/locale_hu-HU.ini
  75. 0
    1
      options/locale/locale_id-ID.ini
  76. 0
    1
      options/locale/locale_is-IS.ini
  77. 0
    1
      options/locale/locale_it-IT.ini
  78. 21
    11
      options/locale/locale_ja-JP.ini
  79. 0
    1
      options/locale/locale_ko-KR.ini
  80. 0
    1
      options/locale/locale_lv-LV.ini
  81. 0
    1
      options/locale/locale_nl-NL.ini
  82. 0
    1
      options/locale/locale_pl-PL.ini
  83. 0
    1
      options/locale/locale_pt-BR.ini
  84. 0
    1
      options/locale/locale_pt-PT.ini
  85. 0
    1
      options/locale/locale_ru-RU.ini
  86. 0
    1
      options/locale/locale_si-LK.ini
  87. 0
    1
      options/locale/locale_sk-SK.ini
  88. 0
    1
      options/locale/locale_sv-SE.ini
  89. 0
    1
      options/locale/locale_tr-TR.ini
  90. 0
    1
      options/locale/locale_uk-UA.ini
  91. 0
    1
      options/locale/locale_zh-CN.ini
  92. 0
    1
      options/locale/locale_zh-HK.ini
  93. 0
    1
      options/locale/locale_zh-TW.ini
  94. 0
    1
      routers/api/actions/artifacts.go
  95. 2
    2
      routers/api/packages/alpine/alpine.go
  96. 2
    2
      routers/api/packages/conan/conan.go
  97. 2
    2
      routers/api/packages/conda/conda.go
  98. 3
    3
      routers/api/packages/container/container.go
  99. 2
    2
      routers/api/packages/cran/cran.go
  100. 0
    0
      routers/api/packages/debian/debian.go

+ 4
- 4
.eslintrc.yaml 查看文件

@@ -310,7 +310,7 @@ rules:
jquery/no-merge: [2]
jquery/no-param: [2]
jquery/no-parent: [0]
jquery/no-parents: [0]
jquery/no-parents: [2]
jquery/no-parse-html: [2]
jquery/no-prop: [2]
jquery/no-proxy: [2]
@@ -319,8 +319,8 @@ rules:
jquery/no-show: [2]
jquery/no-size: [2]
jquery/no-sizzle: [2]
jquery/no-slide: [0]
jquery/no-submit: [0]
jquery/no-slide: [2]
jquery/no-submit: [2]
jquery/no-text: [0]
jquery/no-toggle: [2]
jquery/no-trigger: [0]
@@ -458,7 +458,7 @@ rules:
no-jquery/no-other-utils: [2]
no-jquery/no-param: [2]
no-jquery/no-parent: [0]
no-jquery/no-parents: [0]
no-jquery/no-parents: [2]
no-jquery/no-parse-html-literal: [0]
no-jquery/no-parse-html: [2]
no-jquery/no-parse-json: [2]

+ 32
- 23
.golangci.yml 查看文件

@@ -1,13 +1,14 @@
linters:
enable-all: false
disable-all: true
fast: false
enable:
- bidichk
# - deadcode # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- depguard
- dupl
- errcheck
- forbidigo
- gocritic
# - gocyclo # The cyclomatic complexety of a lot of functions is too high, we should refactor those another time.
- gofmt
- gofumpt
- gosimple
@@ -17,20 +18,18 @@ linters:
- nolintlint
- revive
- staticcheck
# - structcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- stylecheck
- typecheck
- unconvert
- unused
# - varcheck # deprecated - https://github.com/golangci/golangci-lint/issues/1841
- wastedassign
enable-all: false
disable-all: true
fast: false

run:
timeout: 10m

output:
sort-results: true

linters-settings:
stylecheck:
checks: ["all", "-ST1005", "-ST1003"]
@@ -47,27 +46,37 @@ linters-settings:
errorCode: 1
warningCode: 1
rules:
- name: atomic
- name: bare-return
- name: blank-imports
- name: constant-logical-expr
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: duplicated-imports
- name: empty-lines
- name: error-naming
- name: error-return
- name: error-strings
- name: error-naming
- name: errorf
- name: exported
- name: identical-branches
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: indent-error-flow
- name: modifies-value-receiver
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: string-of-int
- name: superfluous-else
- name: time-naming
- name: unconditional-recursion
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: duplicated-imports
- name: modifies-value-receiver
- name: unreachable-code
- name: var-declaration
- name: var-naming
gofumpt:
extra-rules: true
depguard:
@@ -93,8 +102,8 @@ issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-dirs: [node_modules, public, web_src]
exclude-case-sensitive: true
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocyclo
@@ -112,19 +121,19 @@ issues:
- path: cmd
linters:
- forbidigo
- linters:
- text: "webhook"
linters:
- dupl
text: "webhook"
- linters:
- text: "`ID' should not be capitalized"
linters:
- gocritic
text: "`ID' should not be capitalized"
- linters:
- text: "swagger"
linters:
- unused
- deadcode
text: "swagger"
- linters:
- text: "argument x is overwritten before first use"
linters:
- staticcheck
text: "argument x is overwritten before first use"
- text: "commentFormatting: put a space between `//` and comment text"
linters:
- gocritic

+ 5
- 5
assets/go-licenses.json
文件差异内容过多而无法显示
查看文件


+ 2
- 1
cmd/admin_auth.go 查看文件

@@ -4,6 +4,7 @@
package cmd

import (
"errors"
"fmt"
"os"
"text/tabwriter"
@@ -91,7 +92,7 @@ func runListAuth(c *cli.Context) error {

func runDeleteAuth(c *cli.Context) error {
if !c.IsSet("id") {
return fmt.Errorf("--id flag is missing")
return errors.New("--id flag is missing")
}

ctx, cancel := installSignals()

+ 2
- 1
cmd/admin_auth_oauth.go 查看文件

@@ -4,6 +4,7 @@
package cmd

import (
"errors"
"fmt"
"net/url"

@@ -193,7 +194,7 @@ func runAddOauth(c *cli.Context) error {

func runUpdateOauth(c *cli.Context) error {
if !c.IsSet("id") {
return fmt.Errorf("--id flag is missing")
return errors.New("--id flag is missing")
}

ctx, cancel := installSignals()

+ 1
- 2
cmd/admin_auth_stmp.go 查看文件

@@ -5,7 +5,6 @@ package cmd

import (
"errors"
"fmt"
"strings"

auth_model "code.gitea.io/gitea/models/auth"
@@ -166,7 +165,7 @@ func runAddSMTP(c *cli.Context) error {

func runUpdateSMTP(c *cli.Context) error {
if !c.IsSet("id") {
return fmt.Errorf("--id flag is missing")
return errors.New("--id flag is missing")
}

ctx, cancel := installSignals()

+ 2
- 1
cmd/admin_user_delete.go 查看文件

@@ -4,6 +4,7 @@
package cmd

import (
"errors"
"fmt"
"strings"

@@ -42,7 +43,7 @@ var microcmdUserDelete = &cli.Command{

func runDeleteUser(c *cli.Context) error {
if !c.IsSet("id") && !c.IsSet("username") && !c.IsSet("email") {
return fmt.Errorf("You must provide the id, username or email of a user to delete")
return errors.New("You must provide the id, username or email of a user to delete")
}

ctx, cancel := installSignals()

+ 3
- 2
cmd/admin_user_generate_access_token.go 查看文件

@@ -4,6 +4,7 @@
package cmd

import (
"errors"
"fmt"

auth_model "code.gitea.io/gitea/models/auth"
@@ -42,7 +43,7 @@ var microcmdUserGenerateAccessToken = &cli.Command{

func runGenerateAccessToken(c *cli.Context) error {
if !c.IsSet("username") {
return fmt.Errorf("You must provide a username to generate a token for")
return errors.New("You must provide a username to generate a token for")
}

ctx, cancel := installSignals()
@@ -68,7 +69,7 @@ func runGenerateAccessToken(c *cli.Context) error {
return err
}
if exist {
return fmt.Errorf("access token name has been used already")
return errors.New("access token name has been used already")
}

// make sure the scopes are valid

+ 34
- 24
cmd/dump.go 查看文件

@@ -87,6 +87,10 @@ var CmdDump = &cli.Command{
Name: "skip-index",
Usage: "Skip bleve index data",
},
&cli.BoolFlag{
Name: "skip-db",
Usage: "Skip database",
},
&cli.StringFlag{
Name: "type",
Usage: fmt.Sprintf(`Dump output format, default to "zip", supported types: %s`, strings.Join(dump.SupportedOutputTypes, ", ")),
@@ -185,35 +189,41 @@ func runDump(ctx *cli.Context) error {
}
}

tmpDir := ctx.String("tempdir")
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
fatal("Path does not exist: %s", tmpDir)
}
if ctx.Bool("skip-db") {
// Ensure that we don't dump the database file that may reside in setting.AppDataPath or elsewhere.
dumper.GlobalExcludeAbsPath(setting.Database.Path)
log.Info("Skipping database")
} else {
tmpDir := ctx.String("tempdir")
if _, err := os.Stat(tmpDir); os.IsNotExist(err) {
fatal("Path does not exist: %s", tmpDir)
}

dbDump, err := os.CreateTemp(tmpDir, "gitea-db.sql")
if err != nil {
fatal("Failed to create tmp file: %v", err)
}
defer func() {
_ = dbDump.Close()
if err := util.Remove(dbDump.Name()); err != nil {
log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err)
dbDump, err := os.CreateTemp(tmpDir, "gitea-db.sql")
if err != nil {
fatal("Failed to create tmp file: %v", err)
}
}()
defer func() {
_ = dbDump.Close()
if err := util.Remove(dbDump.Name()); err != nil {
log.Warn("Unable to remove temporary file: %s: Error: %v", dbDump.Name(), err)
}
}()

targetDBType := ctx.String("database")
if len(targetDBType) > 0 && targetDBType != setting.Database.Type.String() {
log.Info("Dumping database %s => %s...", setting.Database.Type, targetDBType)
} else {
log.Info("Dumping database...")
}
targetDBType := ctx.String("database")
if len(targetDBType) > 0 && targetDBType != setting.Database.Type.String() {
log.Info("Dumping database %s => %s...", setting.Database.Type, targetDBType)
} else {
log.Info("Dumping database...")
}

if err := db.DumpDatabase(dbDump.Name(), targetDBType); err != nil {
fatal("Failed to dump database: %v", err)
}
if err := db.DumpDatabase(dbDump.Name(), targetDBType); err != nil {
fatal("Failed to dump database: %v", err)
}

if err = dumper.AddFile("gitea-db.sql", dbDump.Name()); err != nil {
fatal("Failed to include gitea-db.sql: %v", err)
if err = dumper.AddFile("gitea-db.sql", dbDump.Name()); err != nil {
fatal("Failed to include gitea-db.sql: %v", err)
}
}

log.Info("Adding custom configuration file from %s", setting.CustomConf)

+ 3
- 3
cmd/embedded.go 查看文件

@@ -157,9 +157,9 @@ func runViewDo(c *cli.Context) error {
}

if len(matchedAssetFiles) == 0 {
return fmt.Errorf("no files matched the given pattern")
return errors.New("no files matched the given pattern")
} else if len(matchedAssetFiles) > 1 {
return fmt.Errorf("too many files matched the given pattern, try to be more specific")
return errors.New("too many files matched the given pattern, try to be more specific")
}

data, err := matchedAssetFiles[0].fs.ReadFile(matchedAssetFiles[0].name)
@@ -180,7 +180,7 @@ func runExtractDo(c *cli.Context) error {
}

if c.NArg() == 0 {
return fmt.Errorf("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
return errors.New("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
}

destdir := "."

+ 1
- 1
cmd/hook.go 查看文件

@@ -465,7 +465,7 @@ func hookPrintResult(output, isCreate bool, branch, url string) {
fmt.Fprintf(os.Stderr, " %s\n", url)
}
fmt.Fprintln(os.Stderr, "")
os.Stderr.Sync()
_ = os.Stderr.Sync()
}

func pushOptions() map[string]string {

+ 2
- 1
cmd/manager_logging.go 查看文件

@@ -4,6 +4,7 @@
package cmd

import (
"errors"
"fmt"
"os"

@@ -249,7 +250,7 @@ func runAddFileLogger(c *cli.Context) error {
if c.IsSet("filename") {
vals["filename"] = c.String("filename")
} else {
return fmt.Errorf("filename must be set when creating a file logger")
return errors.New("filename must be set when creating a file logger")
}
if c.IsSet("rotate") {
vals["rotate"] = c.Bool("rotate")

+ 1
- 2
go.mod 查看文件

@@ -16,7 +16,6 @@ require (
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4
github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358
github.com/NYTimes/gziphandler v1.1.1
github.com/PuerkitoBio/goquery v1.9.1
github.com/alecthomas/chroma/v2 v2.13.0
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
@@ -67,7 +66,7 @@ require (
github.com/json-iterator/go v1.1.12
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4
github.com/klauspost/compress v1.17.7
github.com/klauspost/compress v1.17.8
github.com/klauspost/cpuid/v2 v2.2.7
github.com/lib/pq v1.10.9
github.com/markbates/goth v1.79.0

+ 2
- 4
go.sum 查看文件

@@ -70,8 +70,6 @@ github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBa
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/PuerkitoBio/goquery v1.9.1 h1:mTL6XjbJTZdpfL+Gwl5U2h1l9yEkJjhmlTeV9VPW7UI=
@@ -500,8 +498,8 @@ github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.15.6/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg=
github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=

+ 24
- 2
models/actions/runner.go 查看文件

@@ -270,7 +270,7 @@ func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
// Only affect action runners were a owner ID is set, as actions runners
// could also be created on a repository.
return db.GetEngine(ctx).Table("action_runner").
Join("LEFT", "user", "`action_runner`.owner_id = `user`.id").
Join("LEFT", "`user`", "`action_runner`.owner_id = `user`.id").
Where("`action_runner`.owner_id != ?", 0).
And(builder.IsNull{"`user`.id"}).
Count(new(ActionRunner))
@@ -279,7 +279,7 @@ func CountRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
subQuery := builder.Select("`action_runner`.id").
From("`action_runner`").
Join("LEFT", "user", "`action_runner`.owner_id = `user`.id").
Join("LEFT", "`user`", "`action_runner`.owner_id = `user`.id").
Where(builder.Neq{"`action_runner`.owner_id": 0}).
And(builder.IsNull{"`user`.id"})
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
@@ -289,3 +289,25 @@ func FixRunnersWithoutBelongingOwner(ctx context.Context) (int64, error) {
}
return res.RowsAffected()
}

func CountRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
return db.GetEngine(ctx).Table("action_runner").
Join("LEFT", "`repository`", "`action_runner`.repo_id = `repository`.id").
Where("`action_runner`.repo_id != ?", 0).
And(builder.IsNull{"`repository`.id"}).
Count(new(ActionRunner))
}

func FixRunnersWithoutBelongingRepo(ctx context.Context) (int64, error) {
subQuery := builder.Select("`action_runner`.id").
From("`action_runner`").
Join("LEFT", "`repository`", "`action_runner`.repo_id = `repository`.id").
Where(builder.Neq{"`action_runner`.repo_id": 0}).
And(builder.IsNull{"`repository`.id"})
b := builder.Delete(builder.In("id", subQuery)).From("`action_runner`")
res, err := db.GetEngine(ctx).Exec(b)
if err != nil {
return 0, err
}
return res.RowsAffected()
}

+ 0
- 1
models/asymkey/gpg_key_commit_verification.go 查看文件

@@ -110,7 +110,6 @@ func ParseCommitWithSignature(ctx context.Context, c *git.Commit) *CommitVerific
Reason: "gpg.error.no_committer_account",
}
}

}
}


+ 2
- 1
models/auth/oauth2.go 查看文件

@@ -8,6 +8,7 @@ import (
"crypto/sha256"
"encoding/base32"
"encoding/base64"
"errors"
"fmt"
"net"
"net/url"
@@ -294,7 +295,7 @@ func UpdateOAuth2Application(ctx context.Context, opts UpdateOAuth2ApplicationOp
return nil, err
}
if app.UID != opts.UserID {
return nil, fmt.Errorf("UID mismatch")
return nil, errors.New("UID mismatch")
}
builtinApps := BuiltinApplications()
if _, builtin := builtinApps[app.ClientID]; builtin {

+ 0
- 2
models/auth/oauth2_test.go 查看文件

@@ -13,8 +13,6 @@ import (
"github.com/stretchr/testify/assert"
)

//////////////////// Application

func TestOAuth2Application_GenerateClientSecret(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1})

+ 0
- 1
models/db/engine.go 查看文件

@@ -227,7 +227,6 @@ func NamesToBean(names ...string) ([]any, error) {
// Need to map provided names to beans...
beanMap := make(map[string]any)
for _, bean := range tables {

beanMap[strings.ToLower(reflect.Indirect(reflect.ValueOf(bean)).Type().Name())] = bean
beanMap[strings.ToLower(x.TableName(bean))] = bean
beanMap[strings.ToLower(x.TableName(bean, true))] = bean

+ 2
- 2
models/git/lfs_lock.go 查看文件

@@ -5,7 +5,7 @@ package git

import (
"context"
"fmt"
"errors"
"strings"
"time"

@@ -148,7 +148,7 @@ func DeleteLFSLockByID(ctx context.Context, id int64, repo *repo_model.Repositor
}

if !force && u.ID != lock.OwnerID {
return nil, fmt.Errorf("user doesn't own lock and force flag is not set")
return nil, errors.New("user doesn't own lock and force flag is not set")
}

if _, err := db.GetEngine(dbCtx).ID(id).Delete(new(LFSLock)); err != nil {

+ 0
- 2
models/issues/review.go 查看文件

@@ -345,11 +345,9 @@ func CreateReview(ctx context.Context, opts CreateReviewOptions) (*Review, error
return nil, err
}
}

} else if opts.ReviewerTeam != nil {
review.Type = ReviewTypeRequest
review.ReviewerTeamID = opts.ReviewerTeam.ID

} else {
return nil, fmt.Errorf("provide either reviewer or reviewer team")
}

+ 0
- 5
models/migrations/base/db.go 查看文件

@@ -177,7 +177,6 @@ func RecreateTable(sess *xorm.Session, bean any) error {
log.Error("Unable to recreate uniques on table %s. Error: %v", tableName, err)
return err
}

case setting.Database.Type.IsMySQL():
// MySQL will drop all the constraints on the old table
if _, err := sess.Exec(fmt.Sprintf("DROP TABLE `%s`", tableName)); err != nil {
@@ -228,7 +227,6 @@ func RecreateTable(sess *xorm.Session, bean any) error {
return err
}
sequenceMap[sequence] = sequenceData

}

// CASCADE causes postgres to drop all the constraints on the old table
@@ -293,9 +291,7 @@ func RecreateTable(sess *xorm.Session, bean any) error {
return err
}
}

}

case setting.Database.Type.IsMSSQL():
// MSSQL will drop all the constraints on the old table
if _, err := sess.Exec(fmt.Sprintf("DROP TABLE `%s`", tableName)); err != nil {
@@ -308,7 +304,6 @@ func RecreateTable(sess *xorm.Session, bean any) error {
log.Error("Unable to rename %s to %s. Error: %v", tempTableName, tableName, err)
return err
}

default:
log.Fatal("Unrecognized DB")
}

models/migrations/fixtures/Test_AddConfidentialClientColumnToOAuth2ApplicationTable/o_auth2_application.yml → models/migrations/fixtures/Test_AddConfidentialClientColumnToOAuth2ApplicationTable/oauth2_application.yml 查看文件


+ 2
- 0
models/migrations/migrations.go 查看文件

@@ -584,6 +584,8 @@ var migrations = []Migration{
NewMigration("Add missing field of commit status summary table", v1_23.AddCommitStatusSummary2),
// v297 -> v298
NewMigration("Add everyone_access_mode for repo_unit", v1_23.AddRepoUnitEveryoneAccessMode),
// v298 -> v299
NewMigration("Drop wrongly created table o_auth2_application", v1_23.DropWronglyCreatedTable),
}

// GetCurrentDBVersion returns the current db version

+ 0
- 2
models/migrations/v1_11/v111.go 查看文件

@@ -262,7 +262,6 @@ func AddBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error {
for _, u := range units {
var found bool
for _, team := range teams {

var teamU []*TeamUnit
var unitEnabled bool
err = sess.Where("team_id = ?", team.ID).Find(&teamU)
@@ -331,7 +330,6 @@ func AddBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error {
}

if !protectedBranch.EnableApprovalsWhitelist {

perm, err := getUserRepoPermission(sess, baseRepo, reviewer)
if err != nil {
return false, err

+ 3
- 3
models/migrations/v1_18/v230.go 查看文件

@@ -9,9 +9,9 @@ import (

// AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true
func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error {
type OAuth2Application struct {
type oauth2Application struct {
ID int64
ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"`
}

return x.Sync(new(OAuth2Application))
return x.Sync(new(oauth2Application))
}

+ 3
- 3
models/migrations/v1_18/v230_test.go 查看文件

@@ -13,12 +13,12 @@ import (

func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
// premigration
type OAuth2Application struct {
type oauth2Application struct {
ID int64
}

// Prepare and load the testing database
x, deferable := base.PrepareTestEnv(t, 0, new(OAuth2Application))
x, deferable := base.PrepareTestEnv(t, 0, new(oauth2Application))
defer deferable()
if x == nil || t.Failed() {
return
@@ -36,7 +36,7 @@ func Test_AddConfidentialClientColumnToOAuth2ApplicationTable(t *testing.T) {
}

got := []ExpectedOAuth2Application{}
if err := x.Table("o_auth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
if err := x.Table("oauth2_application").Select("id, confidential_client").Find(&got); !assert.NoError(t, err) {
return
}


+ 2
- 2
models/migrations/v1_20/v250.go 查看文件

@@ -104,7 +104,7 @@ func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {

// Convert to new metadata format

new := &MetadataNew{
newMetadata := &MetadataNew{
Type: old.Type,
IsTagged: old.IsTagged,
Platform: old.Platform,
@@ -119,7 +119,7 @@ func ChangeContainerMetadataMultiArch(x *xorm.Engine) error {
Manifests: manifests,
}

metadataJSON, err := json.Marshal(new)
metadataJSON, err := json.Marshal(newMetadata)
if err != nil {
return err
}

+ 10
- 0
models/migrations/v1_23/v298.go 查看文件

@@ -0,0 +1,10 @@
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package v1_23 //nolint

import "xorm.io/xorm"

func DropWronglyCreatedTable(x *xorm.Engine) error {
return x.DropTables("o_auth2_application")
}

+ 0
- 1
models/migrations/v1_6/v71.go 查看文件

@@ -61,7 +61,6 @@ func AddScratchHash(x *xorm.Engine) error {
if _, err := sess.ID(tfa.ID).Cols("scratch_salt, scratch_hash").Update(tfa); err != nil {
return fmt.Errorf("couldn't add in scratch_hash and scratch_salt: %w", err)
}

}
}


+ 0
- 1
models/migrations/v1_9/v85.go 查看文件

@@ -81,7 +81,6 @@ func HashAppToken(x *xorm.Engine) error {
if _, err := sess.ID(token.ID).Cols("token_hash, token_salt, token_last_eight, sha1").Update(token); err != nil {
return fmt.Errorf("couldn't add in sha1, token_hash, token_salt and token_last_eight: %w", err)
}

}
}


+ 2
- 2
models/org_team.go 查看文件

@@ -118,7 +118,7 @@ func removeAllRepositories(ctx context.Context, t *organization.Team) (err error

// Remove watches from all users and now unaccessible repos
for _, user := range t.Members {
has, err := access_model.HasAccess(ctx, user.ID, repo)
has, err := access_model.HasAnyUnitAccess(ctx, user.ID, repo)
if err != nil {
return err
} else if has {
@@ -544,7 +544,7 @@ func ReconsiderRepoIssuesAssignee(ctx context.Context, repo *repo_model.Reposito
}

func ReconsiderWatches(ctx context.Context, repo *repo_model.Repository, user *user_model.User) error {
if has, err := access_model.HasAccess(ctx, user.ID, repo); err != nil || has {
if has, err := access_model.HasAnyUnitAccess(ctx, user.ID, repo); err != nil || has {
return err
}
if err := repo_model.WatchRepo(ctx, user, repo, false); err != nil {

+ 1
- 2
models/organization/team.go 查看文件

@@ -226,9 +226,8 @@ func GetTeamIDsByNames(ctx context.Context, orgID int64, names []string, ignoreN
if err != nil {
if ignoreNonExistent {
continue
} else {
return nil, err
}
return nil, err
}
ids = append(ids, u.ID)
}

+ 11
- 11
models/packages/package_version.go 查看文件

@@ -287,9 +287,10 @@ func (opts *PackageSearchOptions) configureOrderBy(e db.Engine) {
// SearchVersions gets all versions of packages matching the search options
func SearchVersions(ctx context.Context, opts *PackageSearchOptions) ([]*PackageVersion, int64, error) {
sess := db.GetEngine(ctx).
Where(opts.ToConds()).
Select("package_version.*").
Table("package_version").
Join("INNER", "package", "package.id = package_version.package_id")
Join("INNER", "package", "package.id = package_version.package_id").
Where(opts.ToConds())

opts.configureOrderBy(sess)

@@ -304,19 +305,18 @@ func SearchVersions(ctx context.Context, opts *PackageSearchOptions) ([]*Package

// SearchLatestVersions gets the latest version of every package matching the search options
func SearchLatestVersions(ctx context.Context, opts *PackageSearchOptions) ([]*PackageVersion, int64, error) {
cond := opts.ToConds().
And(builder.Expr("pv2.id IS NULL"))

joinCond := builder.Expr("package_version.package_id = pv2.package_id AND (package_version.created_unix < pv2.created_unix OR (package_version.created_unix = pv2.created_unix AND package_version.id < pv2.id))")
if opts.IsInternal.Has() {
joinCond = joinCond.And(builder.Eq{"pv2.is_internal": opts.IsInternal.Value()})
}
in := builder.
Select("MAX(package_version.id)").
From("package_version").
InnerJoin("package", "package.id = package_version.package_id").
Where(opts.ToConds()).
GroupBy("package_version.package_id")

sess := db.GetEngine(ctx).
Select("package_version.*").
Table("package_version").
Join("LEFT", "package_version pv2", joinCond).
Join("INNER", "package", "package.id = package_version.package_id").
Where(cond)
Where(builder.In("package_version.id", in))

opts.configureOrderBy(sess)


+ 4
- 4
models/perm/access/access_test.go 查看文件

@@ -79,17 +79,17 @@ func TestHasAccess(t *testing.T) {
repo2 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3})
assert.True(t, repo2.IsPrivate)

has, err := access_model.HasAccess(db.DefaultContext, user1.ID, repo1)
has, err := access_model.HasAnyUnitAccess(db.DefaultContext, user1.ID, repo1)
assert.NoError(t, err)
assert.True(t, has)

_, err = access_model.HasAccess(db.DefaultContext, user1.ID, repo2)
_, err = access_model.HasAnyUnitAccess(db.DefaultContext, user1.ID, repo2)
assert.NoError(t, err)

_, err = access_model.HasAccess(db.DefaultContext, user2.ID, repo1)
_, err = access_model.HasAnyUnitAccess(db.DefaultContext, user2.ID, repo1)
assert.NoError(t, err)

_, err = access_model.HasAccess(db.DefaultContext, user2.ID, repo2)
_, err = access_model.HasAnyUnitAccess(db.DefaultContext, user2.ID, repo2)
assert.NoError(t, err)
}


+ 37
- 19
models/perm/access/repo_permission.go 查看文件

@@ -24,6 +24,8 @@ type Permission struct {

units []*repo_model.RepoUnit
unitsMode map[unit.Type]perm_model.AccessMode

everyoneAccessMode map[unit.Type]perm_model.AccessMode
}

// IsOwner returns true if current user is the owner of repository.
@@ -36,9 +38,24 @@ func (p *Permission) IsAdmin() bool {
return p.AccessMode >= perm_model.AccessModeAdmin
}

// HasAccess returns true if the current user might have at least read access to any unit of this repository
func (p *Permission) HasAccess() bool {
return len(p.unitsMode) > 0 || p.AccessMode >= perm_model.AccessModeRead
// HasAnyUnitAccess returns true if the user might have at least one access mode to any unit of this repository.
// It doesn't count the "everyone access mode".
func (p *Permission) HasAnyUnitAccess() bool {
for _, v := range p.unitsMode {
if v >= perm_model.AccessModeRead {
return true
}
}
return p.AccessMode >= perm_model.AccessModeRead
}

func (p *Permission) HasAnyUnitAccessOrEveryoneAccess() bool {
for _, v := range p.everyoneAccessMode {
if v >= perm_model.AccessModeRead {
return true
}
}
return p.HasAnyUnitAccess()
}

// HasUnits returns true if the permission contains attached units
@@ -56,16 +73,16 @@ func (p *Permission) GetFirstUnitRepoID() int64 {
}

// UnitAccessMode returns current user access mode to the specify unit of the repository
// It also considers "everyone access mode"
func (p *Permission) UnitAccessMode(unitType unit.Type) perm_model.AccessMode {
if p.unitsMode != nil {
// if the units map contains the access mode, use it, but admin/owner mode could override it
if m, ok := p.unitsMode[unitType]; ok {
return util.Iif(p.AccessMode >= perm_model.AccessModeAdmin, p.AccessMode, m)
}
// if the units map contains the access mode, use it, but admin/owner mode could override it
if m, ok := p.unitsMode[unitType]; ok {
return util.Iif(p.AccessMode >= perm_model.AccessModeAdmin, p.AccessMode, m)
}
// if the units map does not contain the access mode, return the default access mode if the unit exists
unitDefaultAccessMode := max(p.AccessMode, p.everyoneAccessMode[unitType])
hasUnit := slices.ContainsFunc(p.units, func(u *repo_model.RepoUnit) bool { return u.Type == unitType })
return util.Iif(hasUnit, p.AccessMode, perm_model.AccessModeNone)
return util.Iif(hasUnit, unitDefaultAccessMode, perm_model.AccessModeNone)
}

func (p *Permission) SetUnitsWithDefaultAccessMode(units []*repo_model.RepoUnit, mode perm_model.AccessMode) {
@@ -159,14 +176,15 @@ func (p *Permission) LogString() string {
}

func applyEveryoneRepoPermission(user *user_model.User, perm *Permission) {
if user != nil && user.ID > 0 {
for _, u := range perm.units {
if perm.unitsMode == nil {
perm.unitsMode = make(map[unit.Type]perm_model.AccessMode)
}
if u.EveryoneAccessMode >= perm_model.AccessModeRead && u.EveryoneAccessMode > perm.unitsMode[u.Type] {
perm.unitsMode[u.Type] = u.EveryoneAccessMode
if user == nil || user.ID <= 0 {
return
}
for _, u := range perm.units {
if u.EveryoneAccessMode >= perm_model.AccessModeRead && u.EveryoneAccessMode > perm.everyoneAccessMode[u.Type] {
if perm.everyoneAccessMode == nil {
perm.everyoneAccessMode = make(map[unit.Type]perm_model.AccessMode)
}
perm.everyoneAccessMode[u.Type] = u.EveryoneAccessMode
}
}
}
@@ -373,8 +391,8 @@ func CanBeAssigned(ctx context.Context, user *user_model.User, repo *repo_model.
perm.CanAccessAny(perm_model.AccessModeRead, unit.TypePullRequests), nil
}

// HasAccess returns true if user has access to repo
func HasAccess(ctx context.Context, userID int64, repo *repo_model.Repository) (bool, error) {
// HasAnyUnitAccess see the comment of "perm.HasAnyUnitAccess"
func HasAnyUnitAccess(ctx context.Context, userID int64, repo *repo_model.Repository) (bool, error) {
var user *user_model.User
var err error
if userID > 0 {
@@ -387,7 +405,7 @@ func HasAccess(ctx context.Context, userID int64, repo *repo_model.Repository) (
if err != nil {
return false, err
}
return perm.HasAccess(), nil
return perm.HasAnyUnitAccess(), nil
}

// getUsersWithAccessMode returns users that have at least given access mode to the repository.

+ 41
- 3
models/perm/access/repo_permission_test.go 查看文件

@@ -14,16 +14,54 @@ import (
"github.com/stretchr/testify/assert"
)

func TestHasAnyUnitAccess(t *testing.T) {
perm := Permission{}
assert.False(t, perm.HasAnyUnitAccess())

perm = Permission{
units: []*repo_model.RepoUnit{{Type: unit.TypeWiki}},
}
assert.False(t, perm.HasAnyUnitAccess())
assert.False(t, perm.HasAnyUnitAccessOrEveryoneAccess())

perm = Permission{
units: []*repo_model.RepoUnit{{Type: unit.TypeWiki}},
everyoneAccessMode: map[unit.Type]perm_model.AccessMode{unit.TypeIssues: perm_model.AccessModeRead},
}
assert.False(t, perm.HasAnyUnitAccess())
assert.True(t, perm.HasAnyUnitAccessOrEveryoneAccess())

perm = Permission{
AccessMode: perm_model.AccessModeRead,
units: []*repo_model.RepoUnit{{Type: unit.TypeWiki}},
}
assert.True(t, perm.HasAnyUnitAccess())

perm = Permission{
unitsMode: map[unit.Type]perm_model.AccessMode{unit.TypeWiki: perm_model.AccessModeRead},
}
assert.True(t, perm.HasAnyUnitAccess())
}

func TestApplyEveryoneRepoPermission(t *testing.T) {
perm := Permission{
AccessMode: perm_model.AccessModeNone,
units: []*repo_model.RepoUnit{
{Type: unit.TypeWiki, EveryoneAccessMode: perm_model.AccessModeNone},
{Type: unit.TypeWiki, EveryoneAccessMode: perm_model.AccessModeRead},
},
}
applyEveryoneRepoPermission(nil, &perm)
assert.False(t, perm.CanRead(unit.TypeWiki))

perm = Permission{
AccessMode: perm_model.AccessModeNone,
units: []*repo_model.RepoUnit{
{Type: unit.TypeWiki, EveryoneAccessMode: perm_model.AccessModeRead},
},
}
applyEveryoneRepoPermission(&user_model.User{ID: 0}, &perm)
assert.False(t, perm.CanRead(unit.TypeWiki))

perm = Permission{
AccessMode: perm_model.AccessModeNone,
units: []*repo_model.RepoUnit{
@@ -40,8 +78,8 @@ func TestApplyEveryoneRepoPermission(t *testing.T) {
},
}
applyEveryoneRepoPermission(&user_model.User{ID: 1}, &perm)
assert.True(t, perm.CanRead(unit.TypeWiki))
assert.False(t, perm.CanWrite(unit.TypeWiki)) // because there is no unit mode, so the everyone-mode is used as the unit's access mode
// it should work the same as "EveryoneAccessMode: none" because the default AccessMode should be applied to units
assert.True(t, perm.CanWrite(unit.TypeWiki))

perm = Permission{
units: []*repo_model.RepoUnit{

+ 0
- 1
models/repo/user_repo.go 查看文件

@@ -170,7 +170,6 @@ func GetReviewers(ctx context.Context, repo *Repository, doerID, posterID int64)
// the owner of a private repo needs to be explicitly added.
cond = cond.Or(builder.Eq{"`user`.id": repo.Owner.ID})
}

} else {
// This is a "public" repository:
// Any user that has read access, is a watcher or organization member can be requested to review

+ 2
- 1
models/repo_transfer.go 查看文件

@@ -5,6 +5,7 @@ package models

import (
"context"
"errors"
"fmt"

"code.gitea.io/gitea/models/db"
@@ -147,7 +148,7 @@ func DeleteRepositoryTransfer(ctx context.Context, repoID int64) error {
func TestRepositoryReadyForTransfer(status repo_model.RepositoryStatus) error {
switch status {
case repo_model.RepositoryBeingMigrated:
return fmt.Errorf("repo is not ready, currently migrating")
return errors.New("repo is not ready, currently migrating")
case repo_model.RepositoryPendingTransfer:
return ErrRepoTransferInProgress{}
}

+ 1
- 2
models/user/user.go 查看文件

@@ -988,9 +988,8 @@ func GetUserIDsByNames(ctx context.Context, names []string, ignoreNonExistent bo
if err != nil {
if ignoreNonExistent {
continue
} else {
return nil, err
}
return nil, err
}
ids = append(ids, u.ID)
}

+ 6
- 6
modules/auth/password/password.go 查看文件

@@ -63,16 +63,16 @@ func NewComplexity() {
func setupComplexity(values []string) {
if len(values) != 1 || values[0] != "off" {
for _, val := range values {
if complex, ok := charComplexities[val]; ok {
validChars += complex.ValidChars
requiredList = append(requiredList, complex)
if complexity, ok := charComplexities[val]; ok {
validChars += complexity.ValidChars
requiredList = append(requiredList, complexity)
}
}
if len(requiredList) == 0 {
// No valid character classes found; use all classes as default
for _, complex := range charComplexities {
validChars += complex.ValidChars
requiredList = append(requiredList, complex)
for _, complexity := range charComplexities {
validChars += complexity.ValidChars
requiredList = append(requiredList, complexity)
}
}
}

+ 3
- 3
modules/git/batch_reader.go 查看文件

@@ -307,10 +307,10 @@ func ParseTreeLine(objectFormat ObjectFormat, rd *bufio.Reader, modeBuf, fnameBu

// Deal with the binary hash
idx = 0
len := objectFormat.FullLength() / 2
for idx < len {
length := objectFormat.FullLength() / 2
for idx < length {
var read int
read, err = rd.Read(shaBuf[idx:len])
read, err = rd.Read(shaBuf[idx:length])
n += read
if err != nil {
return mode, fname, sha, n, err

+ 1
- 1
modules/git/commit.go 查看文件

@@ -468,7 +468,7 @@ func parseCommitFileStatus(fileStatus *CommitFileStatus, stdout io.Reader) {
_, _ = rd.Discard(1)
}
for {
modifier, err := rd.ReadSlice('\x00')
modifier, err := rd.ReadString('\x00')
if err != nil {
if err != io.EOF {
log.Error("Unexpected error whilst reading from git log --name-status. Error: %v", err)

+ 1
- 2
modules/git/commit_reader.go 查看文件

@@ -49,9 +49,8 @@ readLoop:
if len(line) > 0 && line[0] == ' ' {
_, _ = signatureSB.Write(line[1:])
continue
} else {
pgpsig = false
}
pgpsig = false
}

if !message {

+ 0
- 1
modules/git/pipeline/lfs_nogogit.go 查看文件

@@ -232,7 +232,6 @@ func FindLFSFile(repo *git.Repository, objectID git.ObjectID) ([]*LFSResult, err
errChan <- err
break
}

}
}()


+ 4
- 4
modules/git/repo_commit.go 查看文件

@@ -251,18 +251,18 @@ func (repo *Repository) CommitsByFileAndRange(opts CommitsByFileAndRangeOptions)
return nil, err
}

len := objectFormat.FullLength()
length := objectFormat.FullLength()
commits := []*Commit{}
shaline := make([]byte, len+1)
shaline := make([]byte, length+1)
for {
n, err := io.ReadFull(stdoutReader, shaline)
if err != nil || n < len {
if err != nil || n < length {
if err == io.EOF {
err = nil
}
return commits, err
}
objectID, err := NewIDFromString(string(shaline[0:len]))
objectID, err := NewIDFromString(string(shaline[0:length]))
if err != nil {
return nil, err
}

+ 0
- 1
modules/git/submodule.go 查看文件

@@ -64,7 +64,6 @@ func getRefURL(refURL, urlPrefix, repoFullName, sshDomain string) string {
// ex: git@try.gitea.io:go-gitea/gitea
match := scpSyntax.FindAllStringSubmatch(refURI, -1)
if len(match) > 0 {

m := match[0]
refHostname := m[2]
pth := m[3]

+ 0
- 2
modules/indexer/code/bleve/bleve.go 查看文件

@@ -191,7 +191,6 @@ func (b *Indexer) addDelete(filename string, repo *repo_model.Repository, batch
func (b *Indexer) Index(ctx context.Context, repo *repo_model.Repository, sha string, changes *internal.RepoChanges) error {
batch := inner_bleve.NewFlushingBatch(b.inner.Indexer, maxBatchSize)
if len(changes.Updates) > 0 {

// Now because of some insanity with git cat-file not immediately failing if not run in a valid git directory we need to run git rev-parse first!
if err := git.EnsureValidGitRepository(ctx, repo.RepoPath()); err != nil {
log.Error("Unable to open git repo: %s for %-v: %v", repo.RepoPath(), repo, err)
@@ -335,7 +334,6 @@ func (b *Indexer) Search(ctx context.Context, opts *internal.SearchOptions) (int
if result, err = b.inner.Indexer.Search(facetRequest); err != nil {
return 0, nil, nil, err
}

}
languagesFacet := result.Facets["languages"]
for _, term := range languagesFacet.Terms.Terms() {

+ 2
- 2
modules/indexer/issues/dboptions.go 查看文件

@@ -68,7 +68,7 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
searchOpt.Paginator = opts.Paginator

switch opts.SortType {
case "":
case "", "latest":
searchOpt.SortBy = SortByCreatedDesc
case "oldest":
searchOpt.SortBy = SortByCreatedAsc
@@ -86,7 +86,7 @@ func ToSearchOptions(keyword string, opts *issues_model.IssuesOptions) *SearchOp
searchOpt.SortBy = SortByDeadlineDesc
case "priority", "priorityrepo", "project-column-sorting":
// Unsupported sort type for search
searchOpt.SortBy = SortByUpdatedDesc
fallthrough
default:
searchOpt.SortBy = SortByUpdatedDesc
}

+ 0
- 1
modules/indexer/issues/elasticsearch/elasticsearch.go 查看文件

@@ -145,7 +145,6 @@ func (b *Indexer) Search(ctx context.Context, options *internal.SearchOptions) (
query := elastic.NewBoolQuery()

if options.Keyword != "" {

searchType := esMultiMatchTypePhrasePrefix
if options.IsFuzzyKeyword {
searchType = esMultiMatchTypeBestFields

+ 0
- 1
modules/log/event_format.go 查看文件

@@ -125,7 +125,6 @@ func EventFormatTextMessage(mode *WriterMode, event *Event, msgFormat string, ms
if mode.Colorize {
buf = append(buf, resetBytes...)
}

}
if flags&(Lshortfile|Llongfile) != 0 {
if mode.Colorize {

+ 0
- 2
modules/markup/markdown/markdown_test.go 查看文件

@@ -466,7 +466,6 @@ func TestColorPreview(t *testing.T) {
res, err := markdown.RenderString(&markup.RenderContext{Ctx: git.DefaultContext}, test.testcase)
assert.NoError(t, err, "Unexpected error in testcase: %q", test.testcase)
assert.Equal(t, template.HTML(test.expected), res, "Unexpected result in testcase %q", test.testcase)

}

negativeTests := []string{
@@ -549,7 +548,6 @@ func TestMathBlock(t *testing.T) {
res, err := markdown.RenderString(&markup.RenderContext{Ctx: git.DefaultContext}, test.testcase)
assert.NoError(t, err, "Unexpected error in testcase: %q", test.testcase)
assert.Equal(t, template.HTML(test.expected), res, "Unexpected result in testcase %q", test.testcase)

}
}


+ 16
- 16
modules/packages/rubygems/marshal.go 查看文件

@@ -147,35 +147,35 @@ func (e *MarshalEncoder) marshalIntInternal(i int64) error {
return e.w.WriteByte(byte(i - 5))
}

var len int
var length int
if 122 < i && i <= 0xff {
len = 1
length = 1
} else if 0xff < i && i <= 0xffff {
len = 2
length = 2
} else if 0xffff < i && i <= 0xffffff {
len = 3
length = 3
} else if 0xffffff < i && i <= 0x3fffffff {
len = 4
length = 4
} else if -0x100 <= i && i < -123 {
len = -1
length = -1
} else if -0x10000 <= i && i < -0x100 {
len = -2
length = -2
} else if -0x1000000 <= i && i < -0x100000 {
len = -3
length = -3
} else if -0x40000000 <= i && i < -0x1000000 {
len = -4
length = -4
} else {
return ErrInvalidIntRange
}

if err := e.w.WriteByte(byte(len)); err != nil {
if err := e.w.WriteByte(byte(length)); err != nil {
return err
}
if len < 0 {
len = -len
if length < 0 {
length = -length
}

for c := 0; c < len; c++ {
for c := 0; c < length; c++ {
if err := e.w.WriteByte(byte(i >> uint(8*c) & 0xff)); err != nil {
return err
}
@@ -244,13 +244,13 @@ func (e *MarshalEncoder) marshalArray(arr reflect.Value) error {
return err
}

len := arr.Len()
length := arr.Len()

if err := e.marshalIntInternal(int64(len)); err != nil {
if err := e.marshalIntInternal(int64(length)); err != nil {
return err
}

for i := 0; i < len; i++ {
for i := 0; i < length; i++ {
if err := e.marshal(arr.Index(i).Interface()); err != nil {
return err
}

+ 0
- 1
modules/process/manager_stacktraces.go 查看文件

@@ -339,7 +339,6 @@ func (pm *Manager) ProcessStacktraces(flat, noSystem bool) ([]*Process, int, int
}
sort.Slice(processes, after(processes))
if !flat {

var sortChildren func(process *Process)

sortChildren = func(process *Process) {

+ 11
- 7
modules/queue/workergroup.go 查看文件

@@ -63,6 +63,8 @@ func (q *WorkerPoolQueue[T]) doDispatchBatchToWorker(wg *workerGroup[T], flushCh
// TODO: the logic could be improved in the future, to avoid a data-race between "doStartNewWorker" and "workerNum"
// The root problem is that if we skip "doStartNewWorker" here, the "workerNum" might be decreased by other workers later
// So ideally, it should check whether there are enough workers by some approaches, and start new workers if necessary.
// This data-race is not serious, as long as a new worker will be started soon to make sure there are enough workers,
// so no need to hugely refactor at the moment.
q.workerNumMu.Lock()
noWorker := q.workerNum == 0
if full || noWorker {
@@ -136,6 +138,14 @@ func (q *WorkerPoolQueue[T]) basePushForShutdown(items ...T) bool {
return true
}

func resetIdleTicker(t *time.Ticker, dur time.Duration) {
t.Reset(dur)
select {
case <-t.C:
default:
}
}

// doStartNewWorker starts a new worker for the queue, the worker reads from worker's channel and handles the items.
func (q *WorkerPoolQueue[T]) doStartNewWorker(wp *workerGroup[T]) {
wp.wg.Add(1)
@@ -146,8 +156,6 @@ func (q *WorkerPoolQueue[T]) doStartNewWorker(wp *workerGroup[T]) {
log.Debug("Queue %q starts new worker", q.GetName())
defer log.Debug("Queue %q stops idle worker", q.GetName())

atomic.AddInt32(&q.workerStartedCounter, 1) // Only increase counter, used for debugging

t := time.NewTicker(workerIdleDuration)
defer t.Stop()

@@ -169,11 +177,7 @@ func (q *WorkerPoolQueue[T]) doStartNewWorker(wp *workerGroup[T]) {
}
q.doWorkerHandle(batch)
// reset the idle ticker, and drain the tick after reset in case a tick is already triggered
t.Reset(workerIdleDuration)
select {
case <-t.C:
default:
}
resetIdleTicker(t, workerIdleDuration) // key code for TestWorkerPoolQueueWorkerIdleReset
case <-t.C:
q.workerNumMu.Lock()
keepWorking = q.workerNum <= 1 // keep the last worker running

+ 0
- 2
modules/queue/workerqueue.go 查看文件

@@ -40,8 +40,6 @@ type WorkerPoolQueue[T any] struct {
workerMaxNum int
workerActiveNum int
workerNumMu sync.Mutex

workerStartedCounter int32
}

type flushType chan struct{}

+ 23
- 10
modules/queue/workerqueue_test.go 查看文件

@@ -5,8 +5,10 @@ package queue

import (
"context"
"slices"
"strconv"
"sync"
"sync/atomic"
"testing"
"time"

@@ -250,23 +252,34 @@ func TestWorkerPoolQueueShutdown(t *testing.T) {

func TestWorkerPoolQueueWorkerIdleReset(t *testing.T) {
defer test.MockVariableValue(&workerIdleDuration, 10*time.Millisecond)()
defer mockBackoffDuration(10 * time.Millisecond)()
defer mockBackoffDuration(5 * time.Millisecond)()

var q *WorkerPoolQueue[int]
var handledCount atomic.Int32
var hasOnlyOneWorkerRunning atomic.Bool
handler := func(items ...int) (unhandled []int) {
time.Sleep(50 * time.Millisecond)
handledCount.Add(int32(len(items)))
// make each work have different duration, and check the active worker number periodically
var activeNums []int
for i := 0; i < 5-items[0]%2; i++ {
time.Sleep(workerIdleDuration * 2)
activeNums = append(activeNums, q.GetWorkerActiveNumber())
}
// When the queue never becomes empty, the existing workers should keep working
// It is not 100% true at the moment because the data-race in workergroup.go is not resolved, see that TODO */
// If the "active worker numbers" is like [2 2 ... 1 1], it means that an existing worker exited and the no new worker is started.
if slices.Equal([]int{1, 1}, activeNums[len(activeNums)-2:]) {
hasOnlyOneWorkerRunning.Store(true)
}
return nil
}

q, _ := newWorkerPoolQueueForTest("test-workpoolqueue", setting.QueueSettings{Type: "channel", BatchLength: 1, MaxWorkers: 2, Length: 100}, handler, false)
q, _ = newWorkerPoolQueueForTest("test-workpoolqueue", setting.QueueSettings{Type: "channel", BatchLength: 1, MaxWorkers: 2, Length: 100}, handler, false)
stop := runWorkerPoolQueue(q)
for i := 0; i < 20; i++ {
for i := 0; i < 100; i++ {
assert.NoError(t, q.Push(i))
}

time.Sleep(500 * time.Millisecond)
assert.EqualValues(t, 2, q.GetWorkerNumber())
assert.EqualValues(t, 2, q.GetWorkerActiveNumber())
// when the queue never becomes empty, the existing workers should keep working
assert.EqualValues(t, 2, q.workerStartedCounter)
assert.Greater(t, int(handledCount.Load()), 4) // make sure there are enough items handled during the test
assert.False(t, hasOnlyOneWorkerRunning.Load(), "a slow handler should not block other workers from starting")
stop()
}

+ 0
- 1
modules/repository/temp.go 查看文件

@@ -32,7 +32,6 @@ func CreateTemporaryPath(prefix string) (string, error) {
if err != nil {
log.Error("Unable to create temporary directory: %s-*.git (%v)", prefix, err)
return "", fmt.Errorf("Failed to create dir %s-*.git: %w", prefix, err)

}
return basePath, nil
}

+ 1
- 2
modules/setting/time.go 查看文件

@@ -19,9 +19,8 @@ func loadTimeFrom(rootCfg ConfigProvider) {
DefaultUILocation, err = time.LoadLocation(zone)
if err != nil {
log.Fatal("Load time zone failed: %v", err)
} else {
log.Info("Default UI Location is %v", zone)
}
log.Info("Default UI Location is %v", zone)
}
if DefaultUILocation == nil {
DefaultUILocation = time.Local

+ 2
- 3
modules/templates/htmlrenderer.go 查看文件

@@ -138,10 +138,9 @@ func wrapTmplErrMsg(msg string) {
if setting.IsProd {
// in prod mode, Gitea must have correct templates to run
log.Fatal("Gitea can't run with template errors: %s", msg)
} else {
// in dev mode, do not need to really exit, because the template errors could be fixed by developer soon and the templates get reloaded
log.Error("There are template errors but Gitea continues to run in dev mode: %s", msg)
}
// in dev mode, do not need to really exit, because the template errors could be fixed by developer soon and the templates get reloaded
log.Error("There are template errors but Gitea continues to run in dev mode: %s", msg)
}

type templateErrorPrettier struct {

+ 1
- 2
modules/templates/mailer.go 查看文件

@@ -84,9 +84,8 @@ func Mailer(ctx context.Context) (*texttmpl.Template, *template.Template) {
if err = buildSubjectBodyTemplate(subjectTemplates, bodyTemplates, tmplName, content); err != nil {
if firstRun {
log.Fatal("Failed to parse mail template, err: %v", err)
} else {
log.Error("Failed to parse mail template, err: %v", err)
}
log.Error("Failed to parse mail template, err: %v", err)
}
}
}

+ 3
- 3
modules/util/util_test.go 查看文件

@@ -121,9 +121,9 @@ func Test_NormalizeEOL(t *testing.T) {
}

func Test_RandomInt(t *testing.T) {
int, err := CryptoRandomInt(255)
assert.True(t, int >= 0)
assert.True(t, int <= 255)
randInt, err := CryptoRandomInt(255)
assert.True(t, randInt >= 0)
assert.True(t, randInt <= 255)
assert.NoError(t, err)
}


+ 13
- 7
modules/web/handler.go 查看文件

@@ -128,6 +128,16 @@ func hasResponseBeenWritten(argsIn []reflect.Value) bool {
return false
}

func wrapHandlerProvider[T http.Handler](hp func(next http.Handler) T, funcInfo *routing.FuncInfo) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
h := hp(next) // this handle could be dynamically generated, so we can't use it for debug info
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
routing.UpdateFuncInfo(req.Context(), funcInfo)
h.ServeHTTP(resp, req)
})
}
}

// toHandlerProvider converts a handler to a handler provider
// A handler provider is a function that takes a "next" http.Handler, it can be used as a middleware
func toHandlerProvider(handler any) func(next http.Handler) http.Handler {
@@ -138,13 +148,9 @@ func toHandlerProvider(handler any) func(next http.Handler) http.Handler {
}

if hp, ok := handler.(func(next http.Handler) http.Handler); ok {
return func(next http.Handler) http.Handler {
h := hp(next) // this handle could be dynamically generated, so we can't use it for debug info
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
routing.UpdateFuncInfo(req.Context(), funcInfo)
h.ServeHTTP(resp, req)
})
}
return wrapHandlerProvider(hp, funcInfo)
} else if hp, ok := handler.(func(http.Handler) http.HandlerFunc); ok {
return wrapHandlerProvider(hp, funcInfo)
}

provider := func(next http.Handler) http.Handler {

+ 10
- 0
options/license/HPND-UC-export-US 查看文件

@@ -0,0 +1,10 @@
Copyright (C) 1985, 1990 Regents of the University of California.

Permission to use, copy, modify, and distribute this
software and its documentation for any purpose and without
fee is hereby granted, provided that the above copyright
notice appear in all copies. The University of California
makes no representations about the suitability of this
software for any purpose. It is provided "as is" without
express or implied warranty. Export of this software outside
of the United States of America may require an export license.

+ 32
- 0
options/license/NCL 查看文件

@@ -0,0 +1,32 @@
Copyright (c) 2004 the University Corporation for Atmospheric
Research ("UCAR"). All rights reserved. Developed by NCAR's
Computational and Information Systems Laboratory, UCAR,
www.cisl.ucar.edu.

Redistribution and use of the Software in source and binary forms,
with or without modification, is permitted provided that the
following conditions are met:

- Neither the names of NCAR's Computational and Information Systems
Laboratory, the University Corporation for Atmospheric Research,
nor the names of its sponsors or contributors may be used to
endorse or promote products derived from this Software without
specific prior written permission.

- Redistributions of source code must retain the above copyright
notices, this list of conditions, and the disclaimer below.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the disclaimer below in the
documentation and/or other materials provided with the
distribution.

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.

+ 0
- 1
options/locale/locale_cs-CZ.ini 查看文件

@@ -1186,7 +1186,6 @@ action.blocked_user=Nelze provést akci, protože jste zablokování vlastníkem
download_archive=Stáhnout repozitář
more_operations=Další operace

no_desc=Bez popisu
quick_guide=Krátká příručka
clone_this_repo=Naklonovat tento repozitář
cite_this_repo=Citovat tento repozitář

+ 0
- 1
options/locale/locale_de-DE.ini 查看文件

@@ -1187,7 +1187,6 @@ action.blocked_user=Die Aktion kann nicht ausgeführt werden, da du vom Reposito
download_archive=Repository herunterladen
more_operations=Weitere Operationen

no_desc=Keine Beschreibung
quick_guide=Kurzanleitung
clone_this_repo=Dieses Repository klonen
cite_this_repo=Dieses Repository zitieren

+ 0
- 1
options/locale/locale_el-GR.ini 查看文件

@@ -1118,7 +1118,6 @@ fork=Fork
download_archive=Λήψη Αποθετηρίου
more_operations=Περισσότερες Λειτουργίες

no_desc=Χωρίς Περιγραφή
quick_guide=Γρήγορος Οδηγός
clone_this_repo=Κλωνοποίηση αυτού του αποθετηρίου
cite_this_repo=Αναφορά σε αυτό το αποθετήριο

+ 0
- 1
options/locale/locale_en-US.ini 查看文件

@@ -1193,7 +1193,6 @@ action.blocked_user = Cannot perform action because you are blocked by the repos
download_archive = Download Repository
more_operations = More Operations

no_desc = No Description
quick_guide = Quick Guide
clone_this_repo = Clone this repository
cite_this_repo = Cite this repository

+ 0
- 1
options/locale/locale_es-ES.ini 查看文件

@@ -1111,7 +1111,6 @@ fork=Fork
download_archive=Descargar repositorio
more_operations=Más operaciones

no_desc=Sin descripción
quick_guide=Guía rápida
clone_this_repo=Clonar este repositorio
cite_this_repo=Citar este repositorio

+ 0
- 1
options/locale/locale_fa-IR.ini 查看文件

@@ -874,7 +874,6 @@ star=ستاره دار کن
fork=انشعاب
download_archive=دانلود مخزن

no_desc=بدون توضیح
quick_guide=راهنمای سریع
clone_this_repo=همسان‌سازی این مخزن
create_new_repo_command=ایجاد یک مخزن جدید در خط فرمان

+ 0
- 1
options/locale/locale_fi-FI.ini 查看文件

@@ -718,7 +718,6 @@ unstar=Poista tähti
star=Tähti
download_archive=Lataa repo

no_desc=Ei kuvausta
quick_guide=Pikaopas
clone_this_repo=Kloonaa tämä repo


+ 0
- 1
options/locale/locale_fr-FR.ini 查看文件

@@ -1130,7 +1130,6 @@ fork=Bifurcation
download_archive=Télécharger ce dépôt
more_operations=Plus d'opérations

no_desc=Aucune description
quick_guide=Introduction rapide
clone_this_repo=Cloner ce dépôt
cite_this_repo=Citer ce dépôt

+ 0
- 1
options/locale/locale_hu-HU.ini 查看文件

@@ -656,7 +656,6 @@ star=Csillagozás
fork=Tükrözés
download_archive=Tároló letöltése

no_desc=Nincs leírás
quick_guide=Gyors útmutató
clone_this_repo=Tároló klónozása
create_new_repo_command=Egy új tároló létrehozása a parancssorból

+ 0
- 1
options/locale/locale_id-ID.ini 查看文件

@@ -570,7 +570,6 @@ star=Bintang
fork=Garpu
download_archive=Unduh Repositori

no_desc=Tidak ada Deskripsi
quick_guide=Panduan Cepat
clone_this_repo=Klon repositori ini
create_new_repo_command=Membuat repositori baru pada baris perintah

+ 0
- 1
options/locale/locale_is-IS.ini 查看文件

@@ -647,7 +647,6 @@ star=Bæta við eftirlæti
fork=Tvískipta
download_archive=Hlaða Miður Geymslu

no_desc=Engin Lýsing
quick_guide=Stuttar Leiðbeiningar
clone_this_repo=Afrita þetta hugbúnaðarsafn
create_new_repo_command=Að búa til nýja geymslu með skipanalínu

+ 0
- 1
options/locale/locale_it-IT.ini 查看文件

@@ -936,7 +936,6 @@ star=Vota
fork=Forka
download_archive=Scarica Repository

no_desc=Nessuna descrizione
quick_guide=Guida rapida
clone_this_repo=Clona questo repository
create_new_repo_command=Creazione di un nuovo repository da riga di comando

+ 21
- 11
options/locale/locale_ja-JP.ini 查看文件

@@ -44,7 +44,7 @@ webauthn_use_twofa=携帯電話から2要素認証コードを使用する
webauthn_error=セキュリティキーを読み取ることができません。
webauthn_unsupported_browser=お使いのブラウザは現在 WebAuthn をサポートしていません。
webauthn_error_unknown=不明なエラーが発生しました。 もう一度やり直してください。
webauthn_error_insecure=WebAuthn はセキュアな接続のみをサポートしています。HTTP 経由でテストする場合は、"localhost" または "127.0.0.1" のオリジンが使用できます。
webauthn_error_insecure=WebAuthn は安全な接続でのみ使用できます。 HTTPでのテストには "localhost" または "127.0.0.1" のオリジンが使用できます。
webauthn_error_unable_to_process=サーバーがリクエストを処理できませんでした。
webauthn_error_duplicated=このリクエストに対しては、許可されていないセキュリティキーです。 キーが未登録であることを確認してください。
webauthn_error_empty=このキーに名前を設定する必要があります。
@@ -163,21 +163,21 @@ no_results_found=見つかりません。
search=検索…
type_tooltip=検索タイプ
fuzzy=あいまい
fuzzy_tooltip=検索ワードに近い結果も含めます
fuzzy_tooltip=検索語におおよそ一致する結果も含めます
repo_kind=リポジトリを検索...
user_kind=ユーザーを検索...
org_kind=組織を検索...
team_kind=チームを検索…
code_kind=コードを検索...
code_search_unavailable=現在コード検索は利用できません。 サイト管理者にお問い合わせください。
code_search_by_git_grep=現在のコード検索結果は "git grep" で提供されています。 サイト管理者がリポジトリインデクサーを有効にすると、より良い結果が得られるかもしれません
code_search_unavailable=コード検索は現在利用できません。 サイト管理者にお問い合わせください。
code_search_by_git_grep=現在のコード検索は "git grep" によって行われています。 サイト管理者がリポジトリインデクサーを有効にすれば、より優れた結果が得られる可能性があります
package_kind=パッケージを検索...
project_kind=プロジェクトを検索...
branch_kind=ブランチを検索...
commit_kind=コミットを検索...
runner_kind=ランナーを検索...
no_results=一致する結果が見つかりませんでした
keyword_search_unavailable=現在キーワード検索は利用できません。 サイト管理者にお問い合わせください。
keyword_search_unavailable=キーワード検索は現在利用できません。 サイト管理者にお問い合わせください。

[aria]
navbar=ナビゲーションバー
@@ -212,9 +212,9 @@ string.asc=A - Z
string.desc=Z - A

[error]
occurred=エラーが発生しました
occurred=エラーが発生しました
report_message=Gitea のバグが疑われる場合は、<a href="https://github.com/go-gitea/gitea/issues" target="_blank">GitHub</a>でIssueを検索して、見つからなければ新しいIssueを作成してください。
missing_csrf=不正なリクエスト: CSRFトークンが不明です
missing_csrf=不正なリクエスト: CSRFトークンがありません
invalid_csrf=不正なリクエスト: CSRFトークンが無効です
not_found=ターゲットが見つかりませんでした。
network_error=ネットワークエラー
@@ -224,11 +224,11 @@ app_desc=自分で立てる、超簡単 Git サービス
install=簡単インストール
install_desc=シンプルに、プラットフォームに応じて<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/installation/install-from-binary">バイナリを実行</a>したり、<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea/tree/master/docker">Docker</a>で動かしたり、<a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/installation/install-from-package">パッケージ</a>を使うだけ。
platform=クロスプラットフォーム
platform_desc=Giteaは<a target="_blank" rel="noopener noreferrer" href="http://golang.org/">Go</a>でコンパイルできる環境ならどこでも動きます: Windows、macOS、Linux、ARM等々、好きなものを選んでください!
platform_desc=Giteaは<a target="_blank" rel="noopener noreferrer" href="http://golang.org/">Go</a>がコンパイル可能なあらゆる環境で動きます: Windows、macOS、Linux、ARMなど。 あなたの好きなものを選んでください!
lightweight=軽量
lightweight_desc=Gitea の最小動作要件は小さくて、安価な Raspberry Pi でも動きます。エネルギー消費を節約しましょう!
lightweight_desc=Gitea の最小動作要件は小さいため、安価な Raspberry Pi でも動きます。エネルギーを節約しましょう!
license=オープンソース
license_desc=Go get <a target="_blank" rel="noopener noreferrer" href="https://code.gitea.io/gitea">code.gitea.io/gitea</a>! 私たちと一緒にこのプロジェクトをより良くしていくために、何か<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">貢献</a>してみませんか。 些細なことでも大丈夫! 積極的にお願いします!
license_desc=Go get <a target="_blank" rel="noopener noreferrer" href="https://code.gitea.io/gitea">code.gitea.io/gitea</a>! このプロジェクトをさらに向上させるため、ぜひ<a target="_blank" rel="noopener noreferrer" href="https://github.com/go-gitea/gitea">貢献</a>して参加してください。 貢献者になることを恥ずかしがらないで!

[install]
install=インストール
@@ -393,6 +393,7 @@ forgot_password_title=パスワードを忘れた
forgot_password=パスワードをお忘れですか?
sign_up_now=アカウントが必要ですか? 今すぐ登録しましょう。
sign_up_successful=アカウントは無事に作成されました。ようこそ!
confirmation_mail_sent_prompt_ex=新しい確認メールを <b>%s</b> に送信しました。 %s以内にメールボックスを確認し、登録手続きを完了してください。 登録メールアドレスが間違っている場合は、もういちどサインインすると変更することができます。
must_change_password=パスワードの更新
allow_password_change=ユーザーはパスワードの変更が必要 (推奨)
reset_password_mail_sent_prompt=<b>%s</b> に確認メールを送信しました。 %s以内に受信トレイを確認し、アカウント回復手続きを完了してください。
@@ -402,6 +403,7 @@ prohibit_login=サインイン禁止
prohibit_login_desc=あなたのアカウントはサインインを禁止されています。 サイト管理者にお問い合わせください。
resent_limit_prompt=少し前に、あなたからアクティベーションメールが要求されています。 3分待ったのち、もう一度試してください。
has_unconfirmed_mail=こんにちは %s さん、あなたのメール アドレス (<b>%s</b>) は確認がとれていません。 確認メールを受け取っていない場合や、改めて送信したい場合は、下のボタンをクリックしてください。
change_unconfirmed_mail_address=登録のメールアドレスが間違っている場合は、こちらで変更して新しい確認メールを再送信することができます。
resend_mail=アクティベーションメールを再送信するにはここをクリック
email_not_associate=このメールアドレスは、どのアカウントにも関連付けられていません。
send_reset_mail=アカウント回復メールを送信
@@ -582,6 +584,7 @@ team_name_been_taken=チーム名が既に使用されています。
team_no_units_error=リポジトリセクションは、少なくともひとつはアクセスを許可してください。
email_been_used=メールアドレスが既に使用されています。
email_invalid=メールアドレスが不正です。
email_domain_is_not_allowed=ユーザーのメールアドレス <b>%s</b> のドメインが、EMAIL_DOMAIN_ALLOWLIST または EMAIL_DOMAIN_BLOCKLIST に違反しています。 あなたの操作が適切なものであるか確認してください。
openid_been_used=OpenIDのアドレス "%s" は既に使用されています。
username_password_incorrect=ユーザー名またはパスワードが間違っています。
password_complexity=パスワードが複雑性の要件を満たしていません:
@@ -593,6 +596,8 @@ enterred_invalid_repo_name=入力したリポジトリ名が間違っていま
enterred_invalid_org_name=入力した Organization の名前が間違っています。
enterred_invalid_owner_name=新しいオーナーの名前が正しくありません。
enterred_invalid_password=入力されたパスワードが間違っています。
unset_password=ログインユーザーはパスワードを設定していません。
unsupported_login_type=ログインの種類がアカウントの削除に対応していません。
user_not_exist=指定されたユーザーは存在しません。
team_not_exist=チームが存在していません。
last_org_owner='Owners'チームから最後のユーザーを削除することはできません。ひとつの組織には少なくとも一人のオーナーが必要です。
@@ -707,6 +712,7 @@ cancel=キャンセル
language=言語
ui=テーマ
hidden_comment_types=非表示にするコメントの種類
hidden_comment_types_description=ここでチェックを入れたコメントの種類は、イシューのページには表示されません。 たとえば「ラベル」にチェックを入れると、「{ユーザー} が {ラベル} を追加/削除」といったコメントはすべて除外されます。
hidden_comment_types.ref_tooltip=このイシューが別のイシューやコミット等から参照された、というコメント
hidden_comment_types.issue_ref_tooltip=このイシューのブランチやタグへの関連付けをユーザーが変更した、というコメント
comment_type_group_reference=参照
@@ -1182,7 +1188,6 @@ action.blocked_user=リポジトリのオーナーがあなたをブロックし
download_archive=リポジトリをダウンロード
more_operations=その他の操作

no_desc=説明なし
quick_guide=クイック ガイド
clone_this_repo=このリポジトリのクローンを作成
cite_this_repo=このリポジトリを引用
@@ -1225,6 +1230,8 @@ file_view_rendered=レンダリング表示
file_view_raw=Rawデータを見る
file_permalink=パーマリンク
file_too_large=このファイルは大きすぎるため、表示できません。
code_preview_line_from_to=%[1]d 行目から %[2]d 行目 in %[3]s
code_preview_line_in=%[1]d 行目 in %[2]s
invisible_runes_header=このファイルには不可視のUnicode文字が含まれています
invisible_runes_description=このファイルには人間が識別できない不可視のUnicode文字が含まれており、コンピューターによって特殊な処理が行われる可能性があります。 それが意図的なものと考えられる場合は、この警告を無視して構いません。 不可視文字を表示するにはエスケープボタンを使用します。
ambiguous_runes_header=このファイルには曖昧(ambiguous)なUnicode文字が含まれています
@@ -1279,6 +1286,7 @@ editor.or=または
editor.cancel_lower=キャンセル
editor.commit_signed_changes=署名した変更をコミット
editor.commit_changes=変更をコミット
editor.add_tmpl='{ファイル名}' を追加
editor.add=%s を追加
editor.update=%s を更新
editor.delete=%s を削除
@@ -3076,12 +3084,14 @@ auths.tips=ヒント
auths.tips.oauth2.general=OAuth2認証
auths.tips.oauth2.general.tip=新しいOAuth2認証を登録するときは、コールバック/リダイレクトURLは以下になります:
auths.tip.oauth2_provider=OAuth2プロバイダー
auths.tip.bitbucket=新しいOAuthコンシューマーを https://bitbucket.org/account/user/{あなたのユーザー名}/oauth-consumers/new から登録し、"アカウント" に "読み取り" 権限を追加してください。
auths.tip.nextcloud=新しいOAuthコンシューマーを、インスタンスのメニュー "Settings -> Security -> OAuth 2.0 client" から登録してください。
auths.tip.dropbox=新しいアプリケーションを https://www.dropbox.com/developers/apps から登録してください。
auths.tip.facebook=新しいアプリケーションを https://developers.facebook.com/apps で登録し、"Facebook Login"を追加してください。
auths.tip.github=新しいOAuthアプリケーションを https://github.com/settings/applications/new から登録してください。
auths.tip.gitlab_new=新しいアプリケーションを https://gitlab.com/-/profile/applications から登録してください。
auths.tip.google_plus=OAuth2クライアント資格情報を、Google APIコンソール https://console.developers.google.com/ から取得してください。
auths.tip.openid_connect=OpenID Connect DiscoveryのURL "https://{server}/.well-known/openid-configuration" をエンドポイントとして指定してください
auths.tip.twitter=https://dev.twitter.com/apps へアクセスしてアプリケーションを作成し、“Allow this application to be used to Sign in with Twitter”オプションを有効にしてください。
auths.tip.discord=新しいアプリケーションを https://discordapp.com/developers/applications/me から登録してください。
auths.tip.gitea=新しいOAuthアプリケーションを登録してください。 利用ガイドは https://docs.gitea.com/development/oauth2-provider にあります

+ 0
- 1
options/locale/locale_ko-KR.ini 查看文件

@@ -606,7 +606,6 @@ star=좋아요
fork=포크
download_archive=저장소 다운로드

no_desc=설명 없음
quick_guide=퀵 가이드
clone_this_repo=이 저장소 복제
create_new_repo_command=커맨드 라인에서 새 레포리지터리 생성

+ 0
- 1
options/locale/locale_lv-LV.ini 查看文件

@@ -1119,7 +1119,6 @@ fork=Atdalīts
download_archive=Lejupielādēt repozitoriju
more_operations=Vairāk darbību

no_desc=Nav apraksta
quick_guide=Īsa pamācība
clone_this_repo=Klonēt šo repozitoriju
cite_this_repo=Citēt šo repozitoriju

+ 0
- 1
options/locale/locale_nl-NL.ini 查看文件

@@ -934,7 +934,6 @@ star=Ster
fork=Vork
download_archive=Download repository

no_desc=Geen omschrijving
quick_guide=Snelstart gids
clone_this_repo=Kloon deze repository
create_new_repo_command=Maak een nieuwe repository aan vanaf de console

+ 0
- 1
options/locale/locale_pl-PL.ini 查看文件

@@ -877,7 +877,6 @@ star=Polub
fork=Forkuj
download_archive=Pobierz repozytorium

no_desc=Brak opisu
quick_guide=Skrócona instrukcja
clone_this_repo=Klonuj repozytorium
create_new_repo_command=Tworzenie nowego repozytorium z linii poleceń

+ 0
- 1
options/locale/locale_pt-BR.ini 查看文件

@@ -1115,7 +1115,6 @@ fork=Fork
download_archive=Baixar repositório
more_operations=Mais Operações

no_desc=Nenhuma descrição
quick_guide=Guia Rápido
clone_this_repo=Clonar este repositório
cite_this_repo=Citar este repositório

+ 0
- 1
options/locale/locale_pt-PT.ini 查看文件

@@ -1193,7 +1193,6 @@ action.blocked_user=Não pode realizar a operação porque foi bloqueado/a pelo/
download_archive=Descarregar repositório
more_operations=Mais operações

no_desc=Sem descrição
quick_guide=Guia rápido
clone_this_repo=Clonar este repositório
cite_this_repo=Citar este repositório

+ 0
- 1
options/locale/locale_ru-RU.ini 查看文件

@@ -1098,7 +1098,6 @@ fork=Форкнуть
download_archive=Скачать репозиторий
more_operations=Ещё действия

no_desc=Нет описания
quick_guide=Краткое руководство
clone_this_repo=Клонировать репозиторий
cite_this_repo=Сослаться на этот репозиторий

+ 0
- 1
options/locale/locale_si-LK.ini 查看文件

@@ -846,7 +846,6 @@ star=ස්ටාර්
fork=දෙබලක
download_archive=කෝෂ්ඨය බාගන්න

no_desc=සවිස්තරයක් නැත
quick_guide=ඉක්මන් මාර්ගෝපදේශය
clone_this_repo=මෙම ගබඩාව පරිගණක ක්රිඩාවට සමාන
create_new_repo_command=විධාන රේඛාවේ නව ගබඩාවක් නිර්මාණය කිරීම

+ 0
- 1
options/locale/locale_sk-SK.ini 查看文件

@@ -964,7 +964,6 @@ star=Hviezdička
download_archive=Stiahnuť repozitár
more_operations=Viac operácií

no_desc=Bez popisu
quick_guide=Rýchly sprievodca
clone_this_repo=Klonovať tento repozitár
create_new_repo_command=Vytvoriť nový repozitár v príkazovom riadku

+ 0
- 1
options/locale/locale_sv-SE.ini 查看文件

@@ -718,7 +718,6 @@ star=Stjärnmärk
fork=Förgrening
download_archive=Ladda Ned Utvecklingskatalogen

no_desc=Ingen beskrivning
quick_guide=Snabbguide
clone_this_repo=Klona detta repo
create_new_repo_command=Skapa en ny utvecklingskatalog på kommandoraden

+ 0
- 1
options/locale/locale_tr-TR.ini 查看文件

@@ -1193,7 +1193,6 @@ action.blocked_user=İşlem gerçekleştirilemiyor, depo sahibi tarafından enge
download_archive=Depoyu İndir
more_operations=Daha Fazla İşlem

no_desc=Açıklama Yok
quick_guide=Hızlı Başlangıç Kılavuzu
clone_this_repo=Bu depoyu klonla
cite_this_repo=Bu depoya atıf ver

+ 0
- 1
options/locale/locale_uk-UA.ini 查看文件

@@ -882,7 +882,6 @@ star=В обрані
fork=Форк
download_archive=Скачати репозиторій

no_desc=Без опису
quick_guide=Короткий посібник
clone_this_repo=Кнонувати цей репозиторій
create_new_repo_command=Створити новий репозиторій з командного рядка

+ 0
- 1
options/locale/locale_zh-CN.ini 查看文件

@@ -1193,7 +1193,6 @@ action.blocked_user=无法执行操作,因为您已被仓库所有者屏蔽。
download_archive=下载此仓库
more_operations=更多操作

no_desc=暂无描述
quick_guide=快速帮助
clone_this_repo=克隆当前仓库
cite_this_repo=引用此仓库

+ 0
- 1
options/locale/locale_zh-HK.ini 查看文件

@@ -344,7 +344,6 @@ unstar=取消收藏
star=收藏
fork=複製

no_desc=暫無描述
quick_guide=快速幫助
clone_this_repo=複製當前儲存庫
create_new_repo_command=從命令列建立新儲存庫。

+ 0
- 1
options/locale/locale_zh-TW.ini 查看文件

@@ -1016,7 +1016,6 @@ fork=Fork
download_archive=下載此儲存庫
more_operations=更多操作

no_desc=暫無描述
quick_guide=快速幫助
clone_this_repo=Clone 此儲存庫
cite_this_repo=引用此儲存庫

+ 0
- 1
routers/api/actions/artifacts.go 查看文件

@@ -144,7 +144,6 @@ func ArtifactContexter() func(next http.Handler) http.Handler {

var task *actions.ActionTask
if err == nil {

task, err = actions.GetTaskByID(req.Context(), tID)
if err != nil {
log.Error("Error runner api getting task by ID: %v", err)

+ 2
- 2
routers/api/packages/alpine/alpine.go 查看文件

@@ -96,12 +96,12 @@ func UploadPackageFile(ctx *context.Context) {
return
}

upload, close, err := ctx.UploadStream()
upload, needToClose, err := ctx.UploadStream()
if err != nil {
apiError(ctx, http.StatusInternalServerError, err)
return
}
if close {
if needToClose {
defer upload.Close()
}


+ 2
- 2
routers/api/packages/conan/conan.go 查看文件

@@ -310,12 +310,12 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey
return
}

upload, close, err := ctx.UploadStream()
upload, needToClose, err := ctx.UploadStream()
if err != nil {
apiError(ctx, http.StatusBadRequest, err)
return
}
if close {
if needToClose {
defer upload.Close()
}


+ 2
- 2
routers/api/packages/conda/conda.go 查看文件

@@ -174,12 +174,12 @@ func EnumeratePackages(ctx *context.Context) {
}

func UploadPackageFile(ctx *context.Context) {
upload, close, err := ctx.UploadStream()
upload, needToClose, err := ctx.UploadStream()
if err != nil {
apiError(ctx, http.StatusInternalServerError, err)
return
}
if close {
if needToClose {
defer upload.Close()
}


+ 3
- 3
routers/api/packages/container/container.go 查看文件

@@ -385,9 +385,9 @@ func EndUploadBlob(ctx *context.Context) {
}
return
}
close := true
doClose := true
defer func() {
if close {
if doClose {
uploader.Close()
}
}()
@@ -427,7 +427,7 @@ func EndUploadBlob(ctx *context.Context) {
apiError(ctx, http.StatusInternalServerError, err)
return
}
close = false
doClose = false

if err := container_service.RemoveBlobUploadByID(ctx, uploader.ID); err != nil {
apiError(ctx, http.StatusInternalServerError, err)

+ 2
- 2
routers/api/packages/cran/cran.go 查看文件

@@ -151,12 +151,12 @@ func UploadBinaryPackageFile(ctx *context.Context) {
}

func uploadPackageFile(ctx *context.Context, compositeKey string, properties map[string]string) {
upload, close, err := ctx.UploadStream()
upload, needToClose, err := ctx.UploadStream()
if err != nil {
apiError(ctx, http.StatusBadRequest, err)
return
}
if close {
if needToClose {
defer upload.Close()
}


+ 0
- 0
routers/api/packages/debian/debian.go 查看文件


部分文件因为文件数量过多而无法显示

正在加载...
取消
保存