Skip to content

Commit a680650

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Remove legacy unmaintained packages, refactor to support change default locale (go-gitea#19308) [skip ci] Updated translations via Crowdin Prevent intermittent NPE in queue tests (go-gitea#19301) Upgrade xorm/builder from v0.3.9 to v0.3.10 (go-gitea#19296) An attempt to sync a non-mirror repo must give 400 (Bad Request) (go-gitea#19300) Remove legacy `unknwon/com` package (go-gitea#19298) Improve package registry docs (go-gitea#19273) A pull-mirror repo should be marked as such on creation (go-gitea#19295) Refactor legacy `unknwon/com` package, improve golangci lint (go-gitea#19284) Skip frontend ROOT_URL check on installation page, remove unnecessary global var (go-gitea#19291)
2 parents dd36434 + d242511 commit a680650

Some content is hidden

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

68 files changed

+1709
-188
lines changed

.golangci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ linters:
1818
- ineffassign
1919
- revive
2020
- gofumpt
21+
- depguard
2122
enable-all: false
2223
disable-all: true
2324
fast: false
@@ -65,7 +66,15 @@ linters-settings:
6566
- name: modifies-value-receiver
6667
gofumpt:
6768
extra-rules: true
68-
lang-version: 1.18
69+
lang-version: "1.18"
70+
depguard:
71+
# TODO: use depguard to replace import checks in gitea-vet
72+
list-type: denylist
73+
# Check the list against standard lib.
74+
include-go-root: true
75+
packages-with-error-message:
76+
- encoding/json: "use gitea's modules/json instead of encoding/json"
77+
- github.com/unknwon/com: "use gitea's util and replacements"
6978

7079
issues:
7180
exclude-rules:
@@ -153,5 +162,6 @@ issues:
153162
- path: models/user/openid.go
154163
linters:
155164
- golint
156-
- linters: staticcheck
165+
- linters:
166+
- staticcheck
157167
text: "strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead."

cmd/manager_logging.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"code.gitea.io/gitea/modules/log"
1313
"code.gitea.io/gitea/modules/private"
14+
1415
"github.com/urfave/cli"
1516
)
1617

contrib/pr/checkout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func runPR() {
112112
unittest.LoadFixtures()
113113
util.RemoveAll(setting.RepoRootPath)
114114
util.RemoveAll(models.LocalCopyPath())
115-
util.CopyDir(path.Join(curDir, "integrations/gitea-repositories-meta"), setting.RepoRootPath)
115+
unittest.CopyDir(path.Join(curDir, "integrations/gitea-repositories-meta"), setting.RepoRootPath)
116116

117117
log.Printf("[PR] Setting up router\n")
118118
// routers.GlobalInit()

custom/conf/app.example.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,6 +2117,7 @@ PATH =
21172117
;[i18n]
21182118
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21192119
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2120+
;; The first locale will be used as the default if user browser's language doesn't match any locale in the list.
21202121
;LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN
21212122
;NAMES = English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,Українська,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,ελληνικά,فارسی,magyar nyelv,bahasa Indonesia,മലയാളം
21222123

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ Default templates for project boards:
997997

998998
## i18n (`i18n`)
999999

1000-
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**: List of locales shown in language selector
1000+
- `LANGS`: **en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pt-PT,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,el-GR,fa-IR,hu-HU,id-ID,ml-IN**:
1001+
List of locales shown in language selector. The first locale will be used as the default if user browser's language doesn't match any locale in the list.
10011002
- `NAMES`: **English,简体中文,繁體中文(香港),繁體中文(台灣),Deutsch,français,Nederlands,latviešu,русский,日本語,español,português do Brasil,Português de Portugal,polski,български,italiano,suomi,Türkçe,čeština,српски,svenska,한국어,ελληνικά,فارسی,magyar nyelv,bahasa Indonesia,മലയാളം**: Visible names corresponding to the locales
10021003

10031004
## U2F (`U2F`) **DEPRECATED**

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ LANGS = en-US,foo-BAR
299299
NAMES = English,FooBar
300300
```
301301

302+
The first locale will be used as the default if user browser's language doesn't match any locale in the list.
303+
302304
Locales may change between versions, so keeping track of your customized locales is highly encouraged.
303305

304306
### Readmes

docs/content/doc/packages/overview.en-us.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ The following package managers are currently supported:
3838

3939
**The following paragraphs only apply if Packages are not globally disabled!**
4040

41+
## Repository-Packages
42+
43+
A package always belongs to an owner (a user or organisation), not a repository.
44+
To link an (already uploaded) package to a repository, open the settings page
45+
on that package and choose a repository to link this package to.
46+
The entire package will be linked, not just a single version.
47+
48+
Linking a package results in showing that package in the repository's package list,
49+
and shows a link to the repository on the package site (as well as a link to the repository issues).
50+
51+
## Access Restrictions
52+
53+
| Package owner type | User | Organization |
54+
|--------------------|------|--------------|
55+
| **read** access | public, if user is public too; otherwise for this user only | public, if org is public, otherwise org members only |
56+
| **write** access | owner only | org members with admin or write access to the org |
57+
58+
N.B.: These access restrictions are [subject to change](https://github.com/go-gitea/gitea/issues/19270), where more finegrained control will be added via a dedicated organization team permission.
59+
60+
## Create or upload a package
61+
62+
Depending on the type of package, use the respective package-manager for that. Check out the sub-page of a specific package manager for instructions.
63+
4164
## View packages
4265

4366
You can view the packages of a repository on the repository page.

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ require (
7878
github.com/stretchr/testify v1.7.0
7979
github.com/syndtr/goleveldb v1.0.0
8080
github.com/tstranex/u2f v1.0.0
81-
github.com/unknwon/com v1.0.1
82-
github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361
83-
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae
8481
github.com/unrolled/render v1.4.1
8582
github.com/urfave/cli v1.22.5
8683
github.com/xanzy/go-gitlab v0.58.0
@@ -101,7 +98,7 @@ require (
10198
gopkg.in/yaml.v2 v2.4.0
10299
mvdan.cc/xurls/v2 v2.4.0
103100
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
104-
xorm.io/builder v0.3.9
101+
xorm.io/builder v0.3.10
105102
xorm.io/xorm v1.2.5
106103
)
107104

@@ -251,6 +248,7 @@ require (
251248
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect
252249
github.com/toqueteos/webbrowser v1.2.0 // indirect
253250
github.com/ulikunitz/xz v0.5.10 // indirect
251+
github.com/unknwon/com v1.0.1 // indirect
254252
github.com/x448/float16 v0.8.4 // indirect
255253
github.com/xanzy/ssh-agent v0.3.1 // indirect
256254
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,10 +1503,6 @@ github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0o
15031503
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
15041504
github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs=
15051505
github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
1506-
github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361 h1:4Ij5sX4JEzCCY/CCl8trJHey1tPsIDomYTZf145GKk0=
1507-
github.com/unknwon/i18n v0.0.0-20210904045753-ff3a8617e361/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ=
1508-
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae h1:ihaXiJkaca54IaCSnEXtE/uSZOmPxKZhDfVLrzZLFDs=
1509-
github.com/unknwon/paginater v0.0.0-20200328080006-042474bd0eae/go.mod h1:1fdkY6xxl6ExVs2QFv7R0F5IRZHKA8RahhB9fMC9RvM=
15101506
github.com/unrolled/render v1.4.1 h1:VdpMc2YkAOWzbmC/P2yoHhRDXgsaCQHcTJ1KK6SNCA4=
15111507
github.com/unrolled/render v1.4.1/go.mod h1:cK4RSTTVdND5j9EYEc0LAMOvdG11JeiKjyjfyZRvV2w=
15121508
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
@@ -2272,7 +2268,6 @@ gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AW
22722268
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
22732269
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
22742270
gopkg.in/ini.v1 v1.44.2/go.mod h1:M3Cogqpuv0QCi3ExAY5V4uOt4qb/R3xZubo9m8lK5wg=
2275-
gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
22762271
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
22772272
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
22782273
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
@@ -2353,7 +2348,8 @@ sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
23532348
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
23542349
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 h1:mUcz5b3FJbP5Cvdq7Khzn6J9OCUQJaBwgBkCR+MOwSs=
23552350
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1:FJGmPh3vz9jSos1L/F91iAgnC/aejc0wIIrF2ZwJxdY=
2356-
xorm.io/builder v0.3.9 h1:Sd65/LdWyO7LR8+Cbd+e7mm3sK/7U9k0jS3999IDHMc=
23572351
xorm.io/builder v0.3.9/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
2352+
xorm.io/builder v0.3.10 h1:Rvkncad3Lo9YIVqCbgIf6QnpR/HcW3IEr0AANNpuyMQ=
2353+
xorm.io/builder v0.3.10/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
23582354
xorm.io/xorm v1.2.5 h1:tqN7OhN8P9xi52qBb76I8m5maAJMz/SSbgK2RGPCPbo=
23592355
xorm.io/xorm v1.2.5/go.mod h1:fTG8tSjk6O1BYxwuohZUK+S1glnRycsCF05L1qQyEU0=

integrations/api_repo_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,27 @@ func testAPIRepoMigrateConflict(t *testing.T, u *url.URL) {
405405
})
406406
}
407407

408+
// mirror-sync must fail with "400 (Bad Request)" when an attempt is made to
409+
// sync a non-mirror repository.
410+
func TestAPIMirrorSyncNonMirrorRepo(t *testing.T) {
411+
defer prepareTestEnv(t)()
412+
413+
session := loginUser(t, "user2")
414+
token := getTokenForLoggedInUser(t, session)
415+
416+
var repo api.Repository
417+
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1")
418+
resp := MakeRequest(t, req, http.StatusOK)
419+
DecodeJSON(t, resp, &repo)
420+
assert.EqualValues(t, false, repo.Mirror)
421+
422+
req = NewRequestf(t, "POST", "/api/v1/repos/user2/repo1/mirror-sync?token=%s", token)
423+
resp = session.MakeRequest(t, req, http.StatusBadRequest)
424+
errRespJSON := map[string]string{}
425+
DecodeJSON(t, resp, &errRespJSON)
426+
assert.Equal(t, "Repository is not a mirror", errRespJSON["message"])
427+
}
428+
408429
func TestAPIOrgRepoCreate(t *testing.T) {
409430
testCases := []struct {
410431
ctxUserID int64

0 commit comments

Comments
 (0)