Skip to content

Commit 849b89f

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into feature-migrate-codebase
2 parents 7345454 + 429ef43 commit 849b89f

File tree

303 files changed

+5721
-3427
lines changed

Some content is hidden

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

303 files changed

+5721
-3427
lines changed

.air.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ bin = "gitea"
77
include_ext = ["go", "tmpl"]
88
exclude_dir = ["modules/git/tests", "services/gitdiff/testdata", "modules/avatar/testdata"]
99
include_dir = ["cmd", "models", "modules", "options", "routers", "services", "templates"]
10+
exclude_regex = ["_test.go$"]

.drone.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
kind: pipeline
3+
type: docker
34
name: compliance
45

56
platform:
@@ -130,6 +131,7 @@ steps:
130131

131132
---
132133
kind: pipeline
134+
type: docker
133135
name: testing-amd64
134136

135137
platform:
@@ -191,26 +193,30 @@ steps:
191193
exclude:
192194
- pull_request
193195

194-
- name: build
195-
pull: always
196-
image: golang:1.17
197-
commands:
198-
- make backend
199-
environment:
200-
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
201-
GOSUMDB: sum.golang.org
202-
TAGS: bindata sqlite sqlite_unlock_notify
203-
204196
- name: tag-pre-condition
205197
pull: always
206198
image: drone/git
207199
commands:
208200
- git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA}
209201

210-
- name: fix-permissions
202+
- name: prepare-test-env
211203
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
212204
commands:
213-
- chown -R gitea:gitea .
205+
- ./build/test-env-prepare.sh
206+
207+
- name: build
208+
pull: always
209+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
210+
user: gitea
211+
commands:
212+
- ./build/test-env-check.sh
213+
- make backend
214+
environment:
215+
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
216+
GOSUMDB: sum.golang.org
217+
TAGS: bindata sqlite sqlite_unlock_notify
218+
depends_on:
219+
- prepare-test-env
214220

215221
- name: unit-test
216222
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
@@ -353,21 +359,24 @@ steps:
353359
exclude:
354360
- pull_request
355361

356-
- name: fix-permissions
362+
- name: prepare-test-env
357363
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
358364
commands:
359-
- chown -R gitea:gitea .
365+
- ./build/test-env-prepare.sh
360366

361367
- name: build
362368
pull: always
363369
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
364370
user: gitea
365371
commands:
372+
- ./build/test-env-check.sh
366373
- make backend
367374
environment:
368375
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
369376
GOSUMDB: sum.golang.org
370377
TAGS: bindata gogit sqlite sqlite_unlock_notify
378+
depends_on:
379+
- prepare-test-env
371380

372381
- name: test-sqlite
373382
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
@@ -461,6 +470,7 @@ steps:
461470

462471
---
463472
kind: pipeline
473+
type: docker
464474
name: update_gitignore_and_licenses
465475

466476
platform:
@@ -497,6 +507,7 @@ steps:
497507

498508
---
499509
kind: pipeline
510+
type: docker
500511
name: release-latest
501512

502513
platform:
@@ -675,6 +686,7 @@ steps:
675686

676687
---
677688
kind: pipeline
689+
type: docker
678690
name: docs
679691

680692
platform:
@@ -716,6 +728,7 @@ steps:
716728

717729
---
718730
kind: pipeline
731+
type: docker
719732
name: docker-linux-amd64-release-version
720733

721734
platform:
@@ -780,6 +793,7 @@ steps:
780793

781794
---
782795
kind: pipeline
796+
type: docker
783797
name: docker-linux-amd64-release
784798

785799
platform:
@@ -844,6 +858,7 @@ steps:
844858

845859
---
846860
kind: pipeline
861+
type: docker
847862
name: docker-linux-arm64-dry-run
848863

849864
platform:
@@ -876,6 +891,7 @@ steps:
876891

877892
---
878893
kind: pipeline
894+
type: docker
879895
name: docker-linux-arm64-release-version
880896

881897
platform:
@@ -943,6 +959,7 @@ steps:
943959

944960
---
945961
kind: pipeline
962+
type: docker
946963
name: docker-linux-arm64-release
947964

948965
platform:
@@ -1009,6 +1026,7 @@ steps:
10091026
- pull_request
10101027
---
10111028
kind: pipeline
1029+
type: docker
10121030
name: docker-manifest-version
10131031

10141032
platform:
@@ -1052,6 +1070,7 @@ depends_on:
10521070

10531071
---
10541072
kind: pipeline
1073+
type: docker
10551074
name: docker-manifest
10561075

10571076
platform:
@@ -1095,6 +1114,7 @@ depends_on:
10951114

10961115
---
10971116
kind: pipeline
1117+
type: docker
10981118
name: notifications
10991119

11001120
platform:

.eslintrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins:
1313
- eslint-plugin-import
1414
- eslint-plugin-vue
1515
- eslint-plugin-html
16+
- eslint-plugin-github
1617

1718
extends:
1819
- plugin:vue/recommended
@@ -96,6 +97,23 @@ rules:
9697
function-paren-newline: [0]
9798
generator-star-spacing: [0]
9899
getter-return: [2]
100+
github/array-foreach: [2]
101+
github/async-currenttarget: [2]
102+
github/async-preventdefault: [2]
103+
github/authenticity-token: [0]
104+
github/get-attribute: [2]
105+
github/js-class-name: [0]
106+
github/no-blur: [0]
107+
github/no-d-none: [0]
108+
github/no-dataset: [2]
109+
github/no-implicit-buggy-globals: [0]
110+
github/no-inner-html: [0]
111+
github/no-innerText: [2]
112+
github/no-then: [2]
113+
github/no-useless-passive: [2]
114+
github/prefer-observers: [0]
115+
github/require-passive-events: [2]
116+
github/unescaped-html-literal: [0]
99117
grouped-accessor-pairs: [2]
100118
guard-for-in: [0]
101119
id-blacklist: [0]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ lint: lint-frontend lint-backend
328328

329329
.PHONY: lint-frontend
330330
lint-frontend: node_modules
331-
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js
331+
npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js
332332
npx stylelint --color --max-warnings=0 web_src/less
333333
npx editorconfig-checker templates
334334

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ or if sqlite support is required:
7474
The `build` target is split into two sub-targets:
7575

7676
- `make backend` which requires [Go 1.16](https://golang.org/dl/) or greater.
77-
- `make frontend` which requires [Node.js 12.17](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
77+
- `make frontend` which requires [Node.js LTS](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
7878

7979
When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js and Internet connectivity.
8080

build/codeformat/formatimports_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import (
5050
"bytes"
5151
"fmt"
5252
"image"
53-
"image/color/palette"
53+
"image/color"
5454
5555
_ "image/gif" // for processing gif images
5656
_ "image/jpeg" // for processing jpeg images
@@ -76,7 +76,7 @@ import (
7676
"bytes"
7777
"fmt"
7878
"image"
79-
"image/color/palette"
79+
"image/color"
8080
8181
_ "image/gif" // for processing gif images
8282
_ "image/jpeg" // for processing jpeg images

build/generate-images.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ async function main() {
8080
]);
8181
}
8282

83-
main().then(exit).catch(exit);
83+
main().then(exit).catch(exit); // eslint-disable-line github/no-then
8484

build/generate-svg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ async function main() {
5454
]);
5555
}
5656

57-
main().then(exit).catch(exit);
57+
main().then(exit).catch(exit); // eslint-disable-line github/no-then
5858

build/test-env-check.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ ! -f ./build/test-env-check.sh ]; then
6+
echo "${0} can only be executed in gitea source root directory"
7+
exit 1
8+
fi
9+
10+
11+
echo "check uid ..."
12+
13+
# the uid of gitea defined in "https://gitea.com/gitea/test-env" is 1000
14+
gitea_uid=$(id -u gitea)
15+
if [ "$gitea_uid" != "1000" ]; then
16+
echo "The uid of linux user 'gitea' is expected to be 1000, but it is $gitea_uid"
17+
exit 1
18+
fi
19+
20+
cur_uid=$(id -u)
21+
if [ "$cur_uid" != "0" -a "$cur_uid" != "$gitea_uid" ]; then
22+
echo "The uid of current linux user is expected to be 0 or $gitea_uid, but it is $cur_uid"
23+
exit 1
24+
fi

build/test-env-prepare.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if [ ! -f ./build/test-env-prepare.sh ]; then
6+
echo "${0} can only be executed in gitea source root directory"
7+
exit 1
8+
fi
9+
10+
echo "change the owner of files to gitea ..."
11+
chown -R gitea:gitea .

cmd/admin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
auth_service "code.gitea.io/gitea/services/auth"
2727
"code.gitea.io/gitea/services/auth/source/oauth2"
2828
repo_service "code.gitea.io/gitea/services/repository"
29+
user_service "code.gitea.io/gitea/services/user"
2930

3031
"github.com/urfave/cli"
3132
)
@@ -365,7 +366,7 @@ func runChangePassword(c *cli.Context) error {
365366
return err
366367
}
367368

368-
if err = models.UpdateUserCols(user, "passwd", "passwd_hash_algo", "salt"); err != nil {
369+
if err = models.UpdateUserCols(db.DefaultContext, user, "passwd", "passwd_hash_algo", "salt"); err != nil {
369370
return err
370371
}
371372

@@ -534,7 +535,7 @@ func runDeleteUser(c *cli.Context) error {
534535
return fmt.Errorf("The user %s does not match the provided id %d", user.Name, c.Int64("id"))
535536
}
536537

537-
return models.DeleteUser(user)
538+
return user_service.DeleteUser(user)
538539
}
539540

540541
func runRepoSyncReleases(_ *cli.Context) error {

cmd/migrate_storage.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"code.gitea.io/gitea/models"
1313
"code.gitea.io/gitea/models/db"
1414
"code.gitea.io/gitea/models/migrations"
15+
repo_model "code.gitea.io/gitea/models/repo"
1516
"code.gitea.io/gitea/modules/log"
1617
"code.gitea.io/gitea/modules/setting"
1718
"code.gitea.io/gitea/modules/storage"
@@ -79,7 +80,7 @@ var CmdMigrateStorage = cli.Command{
7980
}
8081

8182
func migrateAttachments(dstStorage storage.ObjectStorage) error {
82-
return models.IterateAttachment(func(attach *models.Attachment) error {
83+
return repo_model.IterateAttachment(func(attach *repo_model.Attachment) error {
8384
_, err := storage.Copy(dstStorage, attach.RelativePath(), storage.Attachments, attach.RelativePath())
8485
return err
8586
})

cmd/web_graceful.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package cmd
66

77
import (
8-
"crypto/tls"
98
"net"
109
"net/http"
1110
"net/http/fcgi"
@@ -20,14 +19,6 @@ func runHTTP(network, listenAddr, name string, m http.Handler) error {
2019
return graceful.HTTPListenAndServe(network, listenAddr, name, m)
2120
}
2221

23-
func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handler) error {
24-
return graceful.HTTPListenAndServeTLS(network, listenAddr, name, certFile, keyFile, m)
25-
}
26-
27-
func runHTTPSWithTLSConfig(network, listenAddr, name string, tlsConfig *tls.Config, m http.Handler) error {
28-
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m)
29-
}
30-
3122
// NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
3223
func NoHTTPRedirector() {
3324
graceful.GetManager().InformCleanup()

0 commit comments

Comments
 (0)