Skip to content

Commit ace2fd1

Browse files
author
Gusted
committed
Merge branch 'main' into wow-maths
2 parents 78bdc57 + fd97c4e commit ace2fd1

File tree

184 files changed

+532
-462
lines changed

Some content is hidden

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

184 files changed

+532
-462
lines changed

.golangci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ linters:
1919
- revive
2020
- gofumpt
2121
- depguard
22+
- nakedret
23+
- unconvert
24+
- wastedassign
25+
- nolintlint
26+
- stylecheck
2227
enable-all: false
2328
disable-all: true
2429
fast: false
@@ -32,6 +37,10 @@ run:
3237
- web_src
3338

3439
linters-settings:
40+
stylecheck:
41+
checks: ["all", "-ST1005", "-ST1003"]
42+
nakedret:
43+
max-func-lines: 0
3544
gocritic:
3645
disabled-checks:
3746
- ifElseChain

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.16.9](https://github.com/go-gitea/gitea/releases/tag/v1.16.9) - 2022-06-21
8+
9+
* BUGFIXES
10+
* Release page show all tags in compare dropdown (#20070) (#20071)
11+
* Fix permission check for delete tag (#19985) (#20001)
12+
* Only log non ErrNotExist errors in git.GetNote (#19884) (#19905)
13+
* Use exact search instead of fuzzy search for branch filter dropdown (#19885) (#19893)
14+
* Set Setpgid on child git processes (#19865) (#19881)
15+
* Import git from alpine 3.16 repository as 2.30.4 is needed for `safe.directory = '*'` to work but alpine 3.13 has 2.30.3 (#19876)
16+
* Ensure responses are context.ResponseWriters (#19843) (#19859)
17+
* Fix incorrect usage of `Count` function (#19850)
18+
* Fix raw endpoint PDF file headers (#19825) (#19826)
19+
* Make WIP prefixes case insensitive, e.g. allow `Draft` as a WIP prefix (#19780) (#19811)
20+
* Don't return 500 on NotificationUnreadCount (#19802)
21+
* Prevent NPE when cache service is disabled (#19703) (#19783)
22+
* Detect truncated utf-8 characters at the end of content as still representing utf-8 (#19773) (#19774)
23+
* Fix doctor pq: syntax error at or near "." quote user table name (#19765) (#19770)
24+
* Fix bug with assigneees (#19757)
25+
726
## [1.16.8](https://github.com/go-gitea/gitea/releases/tag/v1.16.8) - 2022-05-16
827

928
* ENHANCEMENTS

cmd/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ func writeDataPktLine(out io.Writer, data []byte) error {
792792
if err != nil {
793793
return fail("Internal Server Error", "Pkt-Line response failed: %v", err)
794794
}
795-
if 4 != lr {
795+
if lr != 4 {
796796
return fail("Internal Server Error", "Pkt-Line response failed: %v", err)
797797
}
798798

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.16.8
21+
version: 1.16.9
2222
minGoVersion: 1.18
2323
goVersion: 1.18
2424
minNodeVersion: 14

docs/content/doc/usage/issue-pull-request-templates.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Possible directory names for issue templates:
8585
- `.gitlab/ISSUE_TEMPLATE`
8686
- `.gitlab/issue_template`
8787

88-
Inside the directory can be multiple issue templates with the form
88+
Inside the directory can be multiple markdown (`.md`) issue templates of the form
8989

9090
```md
9191
---

docs/content/doc/usage/permissions.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Different from individual repositories, the owner of organization repositories a
6767
A team in an organization has unit permissions settings. It can have members and repositories scope. A team could access all the repositories in this organization or special repositories changed by the owner team. A team could also be allowed to create new
6868
repositories.
6969

70-
The owner team will be created when the organization created and the creator will become the first member of the owner team.
71-
Notice Gitea will not allow a people is a member of organization but not in any team. The owner team could not be deleted and only
72-
members of owner team could create a new team. Admin team could be created to manage some of repositories, members of admin team
73-
could do anything with these repositories. Generate team could be created by the owner team to do the permissions allowed operations.
70+
The owner team will be created when the organization is created, and the creator will become the first member of the owner team.
71+
Every member of an organization must be in at least one team. The owner team cannot be deleted and only
72+
members of the owner team can create a new team. An admin team can be created to manage some of the repositories, whose members can do anything with these repositories.
73+
The Generate team can be created by the owner team to do the operations allowed by their permissions.

docs/content/doc/usage/reverse-proxies.en-us.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ server {
8888
listen 80;
8989
server_name git.example.com;
9090
91-
location /_/static/assets {
92-
alias /path/to/gitea/public;
91+
location /_/static/assets/ {
92+
alias /path/to/gitea/public/;
9393
}
9494
9595
location / {
@@ -120,8 +120,8 @@ server {
120120
listen 80;
121121
server_name cdn.example.com;
122122
123-
location /gitea {
124-
alias /path/to/gitea/public;
123+
location /gitea/ {
124+
alias /path/to/gitea/public/;
125125
}
126126
127127
location / {
@@ -362,4 +362,4 @@ gitea:
362362
- "traefik.http.services.gitea-websecure.loadbalancer.server.port=3000"
363363
```
364364
365-
This config assumes that you are handling HTTPS on the traefik side and using HTTP between Gitea and traefik.
365+
This config assumes that you are handling HTTPS on the traefik side and using HTTP between Gitea and traefik.

integrations/api_issue_stopwatch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestAPIListStopWatches(t *testing.T) {
3838
assert.EqualValues(t, issue.Title, apiWatches[0].IssueTitle)
3939
assert.EqualValues(t, repo.Name, apiWatches[0].RepoName)
4040
assert.EqualValues(t, repo.OwnerName, apiWatches[0].RepoOwnerName)
41-
assert.Greater(t, int64(apiWatches[0].Seconds), int64(0))
41+
assert.Greater(t, apiWatches[0].Seconds, int64(0))
4242
}
4343
}
4444

integrations/api_packages_container_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestPackageContainer(t *testing.T) {
8888

8989
req = NewRequest(t, "GET", fmt.Sprintf("%sv2", setting.AppURL))
9090
addTokenAuthHeader(req, anonymousToken)
91-
resp = MakeRequest(t, req, http.StatusOK)
91+
MakeRequest(t, req, http.StatusOK)
9292
})
9393

9494
t.Run("User", func(t *testing.T) {
@@ -112,7 +112,7 @@ func TestPackageContainer(t *testing.T) {
112112

113113
req = NewRequest(t, "GET", fmt.Sprintf("%sv2", setting.AppURL))
114114
addTokenAuthHeader(req, userToken)
115-
resp = MakeRequest(t, req, http.StatusOK)
115+
MakeRequest(t, req, http.StatusOK)
116116
})
117117
})
118118

integrations/editor_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestCreateFileOnProtectedBranch(t *testing.T) {
8282
"_csrf": csrf,
8383
"protected": "off",
8484
})
85-
resp = session.MakeRequest(t, req, http.StatusSeeOther)
85+
session.MakeRequest(t, req, http.StatusSeeOther)
8686
// Check if master branch has been locked successfully
8787
flashCookie = session.GetCookie("macaron_flash")
8888
assert.NotNil(t, flashCookie)
@@ -109,7 +109,7 @@ func testEditFile(t *testing.T, session *TestSession, user, repo, branch, filePa
109109
"commit_choice": "direct",
110110
},
111111
)
112-
resp = session.MakeRequest(t, req, http.StatusSeeOther)
112+
session.MakeRequest(t, req, http.StatusSeeOther)
113113

114114
// Verify the change
115115
req = NewRequest(t, "GET", path.Join(user, repo, "raw/branch", branch, filePath))
@@ -139,7 +139,7 @@ func testEditFileToNewBranch(t *testing.T, session *TestSession, user, repo, bra
139139
"new_branch_name": targetBranch,
140140
},
141141
)
142-
resp = session.MakeRequest(t, req, http.StatusSeeOther)
142+
session.MakeRequest(t, req, http.StatusSeeOther)
143143

144144
// Verify the change
145145
req = NewRequest(t, "GET", path.Join(user, repo, "raw/branch", targetBranch, filePath))

integrations/git_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func standardCommitAndPushTest(t *testing.T, dstPath string) (little, big string
150150
defer PrintCurrentTest(t)()
151151
little, big = commitAndPushTest(t, dstPath, "data-file-")
152152
})
153-
return
153+
return little, big
154154
}
155155

156156
func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS string) {
@@ -191,7 +191,7 @@ func lfsCommitAndPushTest(t *testing.T, dstPath string) (littleLFS, bigLFS strin
191191
lockTest(t, dstPath)
192192
})
193193
})
194-
return
194+
return littleLFS, bigLFS
195195
}
196196

197197
func commitAndPushTest(t *testing.T, dstPath, prefix string) (little, big string) {
@@ -210,7 +210,7 @@ func commitAndPushTest(t *testing.T, dstPath, prefix string) (little, big string
210210
big = doCommitAndPush(t, bigSize, dstPath, prefix)
211211
})
212212
})
213-
return
213+
return little, big
214214
}
215215

216216
func rawTest(t *testing.T, ctx *APITestContext, little, big, littleLFS, bigLFS string) {

integrations/integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func getTokenForLoggedInUser(t testing.TB, session *TestSession) string {
438438
"_csrf": doc.GetCSRF(),
439439
"name": fmt.Sprintf("api-testing-token-%d", tokenCounter),
440440
})
441-
resp = session.MakeRequest(t, req, http.StatusSeeOther)
441+
session.MakeRequest(t, req, http.StatusSeeOther)
442442
req = NewRequest(t, "GET", "/user/settings/applications")
443443
resp = session.MakeRequest(t, req, http.StatusOK)
444444
htmlDoc := NewHTMLParser(t, resp.Body)

integrations/nonascii_branches_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func testSrcRouteRedirect(t *testing.T, session *TestSession, user, repo, route,
2626

2727
// Perform redirect
2828
req = NewRequest(t, "GET", location)
29-
resp = session.MakeRequest(t, req, expectedStatus)
29+
session.MakeRequest(t, req, expectedStatus)
3030
}
3131

3232
func setDefaultBranch(t *testing.T, session *TestSession, user, repo, branch string) {

integrations/oauth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func TestAccessTokenExchangeWithBasicAuth(t *testing.T) {
197197
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
198198
})
199199
req.Header.Add("Authorization", "Basic ZGE3ZGEzYmEtOWExMy00MTY3LTg1NmYtMzg5OWRlMGIwMTM4OmJsYWJsYQ==")
200-
resp = MakeRequest(t, req, http.StatusBadRequest)
200+
MakeRequest(t, req, http.StatusBadRequest)
201201

202202
// missing header
203203
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
@@ -206,7 +206,7 @@ func TestAccessTokenExchangeWithBasicAuth(t *testing.T) {
206206
"code": "authcode",
207207
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
208208
})
209-
resp = MakeRequest(t, req, http.StatusBadRequest)
209+
MakeRequest(t, req, http.StatusBadRequest)
210210
}
211211

212212
func TestRefreshTokenInvalidation(t *testing.T) {

integrations/repo_fork_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func testRepoFork(t *testing.T, session *TestSession, ownerName, repoName, forkO
4545
"uid": fmt.Sprintf("%d", forkOwner.ID),
4646
"repo_name": forkRepoName,
4747
})
48-
resp = session.MakeRequest(t, req, http.StatusSeeOther)
48+
session.MakeRequest(t, req, http.StatusSeeOther)
4949

5050
// Step4: check the existence of the forked repo
5151
req = NewRequestf(t, "GET", "/%s/%s", forkOwnerName, forkRepoName)

integrations/repo_generate_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func testRepoGenerate(t *testing.T, session *TestSession, templateOwnerName, tem
4646
"repo_name": generateRepoName,
4747
"git_content": "true",
4848
})
49-
resp = session.MakeRequest(t, req, http.StatusSeeOther)
49+
session.MakeRequest(t, req, http.StatusSeeOther)
5050

5151
// Step4: check the existence of the generated repo
5252
req = NewRequestf(t, "GET", "/%s/%s", generateOwnerName, generateRepoName)

integrations/user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,6 @@ func TestListStopWatches(t *testing.T) {
245245
assert.EqualValues(t, issue.Title, apiWatches[0].IssueTitle)
246246
assert.EqualValues(t, repo.Name, apiWatches[0].RepoName)
247247
assert.EqualValues(t, repo.OwnerName, apiWatches[0].RepoOwnerName)
248-
assert.Greater(t, int64(apiWatches[0].Seconds), int64(0))
248+
assert.Greater(t, apiWatches[0].Seconds, int64(0))
249249
}
250250
}

models/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ func DeleteOldActions(olderThan time.Duration) (err error) {
459459
}
460460

461461
_, err = db.GetEngine(db.DefaultContext).Where("created_unix < ?", time.Now().Add(-olderThan).Unix()).Delete(&Action{})
462-
return
462+
return err
463463
}
464464

465465
func notifyWatchers(ctx context.Context, actions ...*Action) error {

models/admin/notice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ func DeleteOldSystemNotices(olderThan time.Duration) (err error) {
142142
}
143143

144144
_, err = db.GetEngine(db.DefaultContext).Where("created_unix < ?", time.Now().Add(-olderThan).Unix()).Delete(&Notice{})
145-
return
145+
return err
146146
}

models/asymkey/gpg_key_commit_verification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,5 +520,5 @@ func CalculateTrustStatus(verification *CommitVerification, repoTrustModel repo_
520520
}
521521
}
522522

523-
return
523+
return err
524524
}

models/asymkey/ssh_key_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func TestFromOpenSSH(t *testing.T) {
317317
td := t.TempDir()
318318

319319
data := []byte("hello, ssh world")
320-
dataPath := write(t, []byte(data), td, "data")
320+
dataPath := write(t, data, td, "data")
321321

322322
privPath := write(t, []byte(tt.priv), td, "id")
323323
write(t, []byte(tt.pub), td, "id.pub")
@@ -372,14 +372,14 @@ func TestToOpenSSH(t *testing.T) {
372372
td := t.TempDir()
373373

374374
data := []byte("hello, ssh world")
375-
write(t, []byte(data), td, "data")
375+
write(t, data, td, "data")
376376

377377
armored, err := sshsig.Sign([]byte(tt.priv), bytes.NewReader(data), "file")
378378
if err != nil {
379379
t.Fatal(err)
380380
}
381381

382-
sigPath := write(t, []byte(armored), td, "oursig")
382+
sigPath := write(t, armored, td, "oursig")
383383

384384
// Create an allowed_signers file with two keys to check against.
385385
allowedSigner := "[email protected] " + tt.pub + "\n"

models/auth/oauth2.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func GetOAuth2ApplicationByClientID(ctx context.Context, clientID string) (app *
123123
if !has {
124124
return nil, ErrOAuthClientIDInvalid{ClientID: clientID}
125125
}
126-
return
126+
return app, err
127127
}
128128

129129
// GetOAuth2ApplicationByID returns the oauth2 application with the given id. Returns an error if not found.
@@ -143,7 +143,7 @@ func GetOAuth2ApplicationByID(ctx context.Context, id int64) (app *OAuth2Applica
143143
func GetOAuth2ApplicationsByUserID(ctx context.Context, userID int64) (apps []*OAuth2Application, err error) {
144144
apps = make([]*OAuth2Application, 0)
145145
err = db.GetEngine(ctx).Where("uid = ?", userID).Find(&apps)
146-
return
146+
return apps, err
147147
}
148148

149149
// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
@@ -300,7 +300,7 @@ func (code *OAuth2AuthorizationCode) GenerateRedirectURI(state string) (redirect
300300
}
301301
q.Set("code", code.Code)
302302
redirect.RawQuery = q.Encode()
303-
return
303+
return redirect, err
304304
}
305305

306306
// Invalidate deletes the auth code from the database to invalidate this code
@@ -430,7 +430,7 @@ func GetOAuth2GrantByID(ctx context.Context, id int64) (grant *OAuth2Grant, err
430430
} else if !has {
431431
return nil, nil
432432
}
433-
return
433+
return grant, err
434434
}
435435

436436
// GetOAuth2GrantsByUserID lists all grants of a certain user

0 commit comments

Comments
 (0)