Skip to content

Commit 2ba22a8

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 3327b83 + f2a6df0 commit 2ba22a8

File tree

136 files changed

+3998
-3574
lines changed

Some content is hidden

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

136 files changed

+3998
-3574
lines changed

.eslintrc.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ plugins:
2727
- "@stylistic/eslint-plugin-js"
2828
- "@typescript-eslint/eslint-plugin"
2929
- eslint-plugin-array-func
30-
- eslint-plugin-deprecation
3130
- eslint-plugin-github
3231
- eslint-plugin-i
3332
- eslint-plugin-no-jquery
@@ -248,6 +247,7 @@ rules:
248247
"@typescript-eslint/no-base-to-string": [0]
249248
"@typescript-eslint/no-confusing-non-null-assertion": [2]
250249
"@typescript-eslint/no-confusing-void-expression": [0]
250+
"@typescript-eslint/no-deprecated": [2]
251251
"@typescript-eslint/no-dupe-class-members": [0]
252252
"@typescript-eslint/no-duplicate-enum-values": [2]
253253
"@typescript-eslint/no-duplicate-type-constituents": [2, {ignoreUnions: true}]
@@ -359,7 +359,6 @@ rules:
359359
default-case-last: [2]
360360
default-case: [0]
361361
default-param-last: [0]
362-
deprecation/deprecation: [2]
363362
dot-notation: [0]
364363
eqeqeq: [2]
365364
for-direction: [2]
@@ -816,6 +815,7 @@ rules:
816815
unicorn/catch-error-name: [0]
817816
unicorn/consistent-destructuring: [2]
818817
unicorn/consistent-empty-array-spread: [2]
818+
unicorn/consistent-existence-index-check: [0]
819819
unicorn/consistent-function-scoping: [2]
820820
unicorn/custom-error-definition: [0]
821821
unicorn/empty-brace-spaces: [2]
@@ -892,10 +892,12 @@ rules:
892892
unicorn/prefer-dom-node-text-content: [2]
893893
unicorn/prefer-event-target: [2]
894894
unicorn/prefer-export-from: [0]
895+
unicorn/prefer-global-this: [0]
895896
unicorn/prefer-includes: [2]
896897
unicorn/prefer-json-parse-buffer: [0]
897898
unicorn/prefer-keyboard-event-key: [2]
898899
unicorn/prefer-logical-operator-over-ternary: [2]
900+
unicorn/prefer-math-min-max: [2]
899901
unicorn/prefer-math-trunc: [2]
900902
unicorn/prefer-modern-dom-apis: [0]
901903
unicorn/prefer-modern-math-apis: [2]

assets/go-licenses.json

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

build/generate-emoji.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ func (e Emoji) MarshalJSON() ([]byte, error) {
5353
}
5454

5555
func main() {
56-
var err error
57-
5856
flag.Parse()
5957

6058
// generate data
@@ -83,8 +81,6 @@ var replacer = strings.NewReplacer(
8381
var emojiRE = regexp.MustCompile(`\{Emoji:"([^"]*)"`)
8482

8583
func generate() ([]byte, error) {
86-
var err error
87-
8884
// load gemoji data
8985
res, err := http.Get(gemojiURL)
9086
if err != nil {

go.mod

Lines changed: 94 additions & 97 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 226 additions & 236 deletions
Large diffs are not rendered by default.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
-
2+
id: 1
3+
run_id: 791
4+
runner_id: 1
5+
repo_id: 4
6+
owner_id: 1
7+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
8+
storage_path: "26/1/1712166500347189545.chunk"
9+
file_size: 1024
10+
file_compressed_size: 1024
11+
content_encoding: ""
12+
artifact_path: "abc.txt"
13+
artifact_name: "artifact-download"
14+
status: 1
15+
created_unix: 1712338649
16+
updated_unix: 1712338649
17+
expired_unix: 1720114649
18+
19+
-
20+
id: 19
21+
run_id: 791
22+
runner_id: 1
23+
repo_id: 4
24+
owner_id: 1
25+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
26+
storage_path: "26/19/1712348022422036662.chunk"
27+
file_size: 1024
28+
file_compressed_size: 1024
29+
content_encoding: ""
30+
artifact_path: "abc.txt"
31+
artifact_name: "multi-file-download"
32+
status: 2
33+
created_unix: 1712348022
34+
updated_unix: 1712348022
35+
expired_unix: 1720124022
36+
37+
-
38+
id: 20
39+
run_id: 791
40+
runner_id: 1
41+
repo_id: 4
42+
owner_id: 1
43+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
44+
storage_path: "26/20/1712348022423431524.chunk"
45+
file_size: 1024
46+
file_compressed_size: 1024
47+
content_encoding: ""
48+
artifact_path: "xyz/def.txt"
49+
artifact_name: "multi-file-download"
50+
status: 2
51+
created_unix: 1712348022
52+
updated_unix: 1712348022
53+
expired_unix: 1720124022
54+
55+
-
56+
id: 22
57+
run_id: 792
58+
runner_id: 1
59+
repo_id: 4
60+
owner_id: 1
61+
commit_sha: c2d72f548424103f01ee1dc02889c1e2bff816b0
62+
storage_path: "27/5/1730330775594233150.chunk"
63+
file_size: 1024
64+
file_compressed_size: 1024
65+
content_encoding: "application/zip"
66+
artifact_path: "artifact-v4-download.zip"
67+
artifact_name: "artifact-v4-download"
68+
status: 2
69+
created_unix: 1730330775
70+
updated_unix: 1730330775
71+
expired_unix: 1738106775

models/git/lfs.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ var ErrLFSObjectNotExist = db.ErrNotExist{Resource: "LFS Meta object"}
136136
// NewLFSMetaObject stores a given populated LFSMetaObject structure in the database
137137
// if it is not already present.
138138
func NewLFSMetaObject(ctx context.Context, repoID int64, p lfs.Pointer) (*LFSMetaObject, error) {
139-
var err error
140-
141139
ctx, committer, err := db.TxContext(ctx)
142140
if err != nil {
143141
return nil, err

models/issues/label_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ func TestGetLabelsByOrgID(t *testing.T) {
229229
testSuccess(3, "reversealphabetically", []int64{4, 3})
230230
testSuccess(3, "default", []int64{3, 4})
231231

232-
var err error
233-
_, err = issues_model.GetLabelsByOrgID(db.DefaultContext, 0, "leastissues", db.ListOptions{})
232+
_, err := issues_model.GetLabelsByOrgID(db.DefaultContext, 0, "leastissues", db.ListOptions{})
234233
assert.True(t, issues_model.IsErrOrgLabelNotExist(err))
235234

236235
_, err = issues_model.GetLabelsByOrgID(db.DefaultContext, -1, "leastissues", db.ListOptions{})

modules/charset/charset_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,12 @@ func TestMaybeRemoveBOM(t *testing.T) {
4040

4141
func TestToUTF8(t *testing.T) {
4242
resetDefaultCharsetsOrder()
43-
var res string
44-
var err error
4543

4644
// Note: golang compiler seems so behave differently depending on the current
4745
// locale, so some conversions might behave differently. For that reason, we don't
4846
// depend on particular conversions but in expected behaviors.
4947

50-
res, err = ToUTF8([]byte{0x41, 0x42, 0x43}, ConvertOpts{})
48+
res, err := ToUTF8([]byte{0x41, 0x42, 0x43}, ConvertOpts{})
5149
assert.NoError(t, err)
5250
assert.Equal(t, "ABC", res)
5351

modules/git/error.go

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,14 @@
44
package git
55

66
import (
7+
"context"
8+
"errors"
79
"fmt"
810
"strings"
9-
"time"
1011

1112
"code.gitea.io/gitea/modules/util"
1213
)
1314

14-
// ErrExecTimeout error when exec timed out
15-
type ErrExecTimeout struct {
16-
Duration time.Duration
17-
}
18-
19-
// IsErrExecTimeout if some error is ErrExecTimeout
20-
func IsErrExecTimeout(err error) bool {
21-
_, ok := err.(ErrExecTimeout)
22-
return ok
23-
}
24-
25-
func (err ErrExecTimeout) Error() string {
26-
return fmt.Sprintf("execution is timeout [duration: %v]", err.Duration)
27-
}
28-
2915
// ErrNotExist commit not exist error
3016
type ErrNotExist struct {
3117
ID string
@@ -62,21 +48,6 @@ func IsErrBadLink(err error) bool {
6248
return ok
6349
}
6450

65-
// ErrUnsupportedVersion error when required git version not matched
66-
type ErrUnsupportedVersion struct {
67-
Required string
68-
}
69-
70-
// IsErrUnsupportedVersion if some error is ErrUnsupportedVersion
71-
func IsErrUnsupportedVersion(err error) bool {
72-
_, ok := err.(ErrUnsupportedVersion)
73-
return ok
74-
}
75-
76-
func (err ErrUnsupportedVersion) Error() string {
77-
return fmt.Sprintf("Operation requires higher version [required: %s]", err.Required)
78-
}
79-
8051
// ErrBranchNotExist represents a "BranchNotExist" kind of error.
8152
type ErrBranchNotExist struct {
8253
Name string
@@ -185,3 +156,10 @@ func IsErrMoreThanOne(err error) bool {
185156
func (err *ErrMoreThanOne) Error() string {
186157
return fmt.Sprintf("ErrMoreThanOne Error: %v: %s\n%s", err.Err, err.StdErr, err.StdOut)
187158
}
159+
160+
func IsErrCanceledOrKilled(err error) bool {
161+
// When "cancel()" a git command's context, the returned error of "Run()" could be one of them:
162+
// - context.Canceled
163+
// - *exec.ExitError: "signal: killed"
164+
return err != nil && (errors.Is(err, context.Canceled) || err.Error() == "signal: killed")
165+
}

0 commit comments

Comments
 (0)