Skip to content

Commit 2cf8c45

Browse files
authored
Merge branch 'master' into 13658-clickable-links-in-pr-titles
2 parents 8a860a7 + e00a355 commit 2cf8c45

File tree

136 files changed

+1874
-1321
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

+1874
-1321
lines changed

.drone.yml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ steps:
1818
- make node_modules
1919

2020
- name: lint-frontend
21-
pull: always
2221
image: node:14
2322
commands:
2423
- make lint-frontend
@@ -35,7 +34,6 @@ steps:
3534
TAGS: bindata sqlite sqlite_unlock_notify
3635

3736
- name: checks-frontend
38-
pull: always
3937
image: node:14
4038
commands:
4139
- make checks-frontend
@@ -49,7 +47,6 @@ steps:
4947
depends_on: [lint-backend]
5048

5149
- name: build-frontend
52-
pull: always
5350
image: node:14
5451
commands:
5552
- make frontend
@@ -66,7 +63,6 @@ steps:
6663
depends_on: [checks-backend]
6764

6865
- name: build-backend-arm64
69-
pull: always
7066
image: golang:1.15
7167
environment:
7268
GO111MODULE: on
@@ -80,7 +76,6 @@ steps:
8076
depends_on: [checks-backend]
8177

8278
- name: build-backend-386
83-
pull: always
8479
image: golang:1.15
8580
environment:
8681
GO111MODULE: on
@@ -108,33 +103,28 @@ workspace:
108103

109104
services:
110105
- name: mysql
111-
pull: default
112106
image: mysql:5.7
113107
environment:
114108
MYSQL_ALLOW_EMPTY_PASSWORD: yes
115109
MYSQL_DATABASE: test
116110

117111
- name: mysql8
118-
pull: default
119112
image: mysql:8.0
120113
environment:
121114
MYSQL_ALLOW_EMPTY_PASSWORD: yes
122115
MYSQL_DATABASE: testgitea
123116

124117
- name: mssql
125-
pull: default
126118
image: mcr.microsoft.com/mssql/server:latest
127119
environment:
128120
ACCEPT_EULA: Y
129121
MSSQL_PID: Standard
130122
SA_PASSWORD: MwantsaSecurePassword1
131123

132124
- name: ldap
133-
pull: default
134125
image: gitea/test-openldap:latest
135126

136127
- name: elasticsearch
137-
pull: default
138128
environment:
139129
discovery.type: single-node
140130
image: elasticsearch:7.5.0
@@ -149,7 +139,6 @@ services:
149139

150140
steps:
151141
- name: fetch-tags
152-
pull: default
153142
image: docker:git
154143
commands:
155144
- git fetch --tags --force
@@ -175,7 +164,6 @@ steps:
175164
- git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA}
176165

177166
- name: unit-test
178-
pull: always
179167
image: golang:1.15
180168
commands:
181169
- make unit-test-coverage test-check
@@ -186,7 +174,6 @@ steps:
186174
from_secret: github_read_token
187175

188176
- name: test-mysql
189-
pull: always
190177
image: golang:1.15
191178
commands:
192179
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
@@ -202,7 +189,6 @@ steps:
202189
- build
203190

204191
- name: test-mysql8
205-
pull: always
206192
image: golang:1.15
207193
commands:
208194
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
@@ -217,7 +203,6 @@ steps:
217203
- build
218204

219205
- name: test-mssql
220-
pull: always
221206
image: golang:1.15
222207
commands:
223208
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
@@ -232,7 +217,6 @@ steps:
232217
- build
233218

234219
- name: generate-coverage
235-
pull: always
236220
image: golang:1.15
237221
commands:
238222
- make coverage
@@ -295,7 +279,6 @@ services:
295279

296280
steps:
297281
- name: fetch-tags
298-
pull: default
299282
image: docker:git
300283
commands:
301284
- git fetch --tags --force
@@ -315,7 +298,6 @@ steps:
315298
TAGS: bindata sqlite sqlite_unlock_notify
316299

317300
- name: test-sqlite
318-
pull: always
319301
image: golang:1.15
320302
commands:
321303
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
@@ -329,7 +311,6 @@ steps:
329311
- build
330312

331313
- name: test-pgsql
332-
pull: always
333314
image: golang:1.15
334315
commands:
335316
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
@@ -431,7 +412,6 @@ depends_on:
431412

432413
steps:
433414
- name: fetch-tags
434-
pull: default
435415
image: docker:git
436416
commands:
437417
- git fetch --tags --force
@@ -485,7 +465,6 @@ steps:
485465
- push
486466

487467
- name: release-master
488-
pull: always
489468
image: plugins/s3:1
490469
settings:
491470
acl: public-read
@@ -644,7 +623,6 @@ trigger:
644623

645624
steps:
646625
- name: fetch-tags
647-
pull: default
648626
image: docker:git
649627
commands:
650628
- git fetch --tags --force
@@ -668,7 +646,6 @@ steps:
668646
- pull_request
669647

670648
- name: publish-rootless
671-
pull: always
672649
image: plugins/docker:linux-amd64
673650
settings:
674651
dockerfile: Dockerfile.rootless
@@ -747,7 +724,6 @@ trigger:
747724
- "refs/tags/**"
748725
steps:
749726
- name: fetch-tags
750-
pull: default
751727
image: docker:git
752728
commands:
753729
- git fetch --tags --force
@@ -774,7 +750,6 @@ steps:
774750
- pull_request
775751

776752
- name: publish-rootless
777-
pull: always
778753
image: plugins/docker:linux-arm64
779754
settings:
780755
dockerfile: Dockerfile.rootless
@@ -817,7 +792,6 @@ steps:
817792
from_secret: docker_username
818793

819794
- name: manifest
820-
pull: always
821795
image: plugins/manifest
822796
settings:
823797
auto_tag: true

.eslintrc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ reportUnusedDisableDirectives: true
33

44
ignorePatterns:
55
- /web_src/js/vendor
6+
- /templates/base/head.tmpl
7+
- /templates/repo/activity.tmpl
8+
- /templates/repo/view_file.tmpl
69

710
parserOptions:
811
sourceType: module
@@ -12,6 +15,7 @@ plugins:
1215
- eslint-plugin-unicorn
1316
- eslint-plugin-import
1417
- eslint-plugin-vue
18+
- eslint-plugin-html
1519

1620
extends:
1721
- plugin:vue/recommended
@@ -27,12 +31,19 @@ globals:
2731
SimpleMDE: false
2832
u2fApi: false
2933

34+
settings:
35+
html/html-extensions: [".tmpl"]
36+
3037
overrides:
31-
- files: ["web_src/**/*.js", "web_src/**/*.vue"]
38+
- files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
3239
env:
3340
browser: true
3441
jquery: true
3542
node: false
43+
- files: ["templates/**/*.tmpl"]
44+
rules:
45+
no-tabs: [0]
46+
indent: [2, tab, {SwitchCase: 1}]
3647
- files: ["web_src/**/*worker.js"]
3748
env:
3849
worker: true

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ all: build
152152
.PHONY: help
153153
help:
154154
@echo "Make Routines:"
155-
@echo " - \"\" equivalent to \"build\""
155+
@echo " - \"\" equivalent to \"build\""
156156
@echo " - build build everything"
157157
@echo " - frontend build frontend files"
158158
@echo " - backend build backend files"
@@ -180,7 +180,7 @@ help:
180180
@echo " - revive run revive linter"
181181
@echo " - misspell check for misspellings"
182182
@echo " - vet examines Go source code and reports suspicious constructs"
183-
@echo " - test[\#TestSpecificName] run unit test"
183+
@echo " - test[\#TestSpecificName] run unit test"
184184
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
185185
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
186186

@@ -312,7 +312,7 @@ lint: lint-frontend lint-backend
312312

313313
.PHONY: lint-frontend
314314
lint-frontend: node_modules
315-
npx eslint --max-warnings=0 web_src/js build webpack.config.js
315+
npx eslint --max-warnings=0 web_src/js build templates webpack.config.js
316316
npx stylelint --max-warnings=0 web_src/less
317317

318318
.PHONY: lint-backend

build/update-locales.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ sed -i -r -e '/^[a-zA-Z0-9_.-]+[ ]*=[ ]*".*"$/ {
1010
}' ./options/locale/*.ini
1111

1212
# Remove translation under 25% of en_us
13-
baselines=`wc -l "./options/locale_en-US.ini" | cut -d" " -f1`
13+
baselines=$(wc -l "./options/locale_en-US.ini" | cut -d" " -f1)
1414
baselines=$((baselines / 4))
1515
for filename in ./options/locale/*.ini; do
16-
lines=`wc -l "$filename" | cut -d" " -f1`
16+
lines=$(wc -l "$filename" | cut -d" " -f1)
1717
if [ $lines -lt $baselines ]; then
1818
echo "Removing $filename: $lines/$baselines"
1919
rm "$filename"

cmd/dump.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323

2424
"gitea.com/macaron/session"
2525
archiver "github.com/mholt/archiver/v3"
26-
"github.com/unknwon/com"
2726
"github.com/urfave/cli"
2827
)
2928

@@ -306,7 +305,11 @@ func runDump(ctx *cli.Context) error {
306305
log.Info("Custom dir %s doesn't exist, skipped", setting.CustomPath)
307306
}
308307

309-
if com.IsExist(setting.AppDataPath) {
308+
isExist, err := util.IsExist(setting.AppDataPath)
309+
if err != nil {
310+
log.Error("Unable to check if %s exists. Error: %v", setting.AppDataPath, err)
311+
}
312+
if isExist {
310313
log.Info("Packing data directory...%s", setting.AppDataPath)
311314

312315
var excludes []string
@@ -349,9 +352,15 @@ func runDump(ctx *cli.Context) error {
349352
// yet or not.
350353
if ctx.IsSet("skip-log") && ctx.Bool("skip-log") {
351354
log.Info("Skip dumping log files")
352-
} else if com.IsExist(setting.LogRootPath) {
353-
if err := addRecursive(w, "log", setting.LogRootPath, verbose); err != nil {
354-
fatal("Failed to include log: %v", err)
355+
} else {
356+
isExist, err := util.IsExist(setting.LogRootPath)
357+
if err != nil {
358+
log.Error("Unable to check if %s exists. Error: %v", setting.LogRootPath, err)
359+
}
360+
if isExist {
361+
if err := addRecursive(w, "log", setting.LogRootPath, verbose); err != nil {
362+
fatal("Failed to include log: %v", err)
363+
}
355364
}
356365
}
357366

cmd/web.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import (
1616
"code.gitea.io/gitea/modules/graceful"
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
19+
"code.gitea.io/gitea/modules/util"
1920
"code.gitea.io/gitea/routers"
2021
"code.gitea.io/gitea/routers/routes"
2122

2223
context2 "github.com/gorilla/context"
23-
"github.com/unknwon/com"
2424
"github.com/urfave/cli"
2525
"golang.org/x/crypto/acme/autocert"
2626
ini "gopkg.in/ini.v1"
@@ -188,7 +188,11 @@ func setPort(port string) error {
188188
default:
189189
// Save LOCAL_ROOT_URL if port changed
190190
cfg := ini.Empty()
191-
if com.IsFile(setting.CustomConf) {
191+
isFile, err := util.IsFile(setting.CustomConf)
192+
if err != nil {
193+
log.Fatal("Unable to check if %s is a file", err)
194+
}
195+
if isFile {
192196
// Keeps custom settings if there is already something.
193197
if err := cfg.Append(setting.CustomConf); err != nil {
194198
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)

contrib/environment-to-ini/environment-to-ini.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212

1313
"code.gitea.io/gitea/modules/log"
1414
"code.gitea.io/gitea/modules/setting"
15+
"code.gitea.io/gitea/modules/util"
1516

16-
"github.com/unknwon/com"
1717
"github.com/urfave/cli"
1818
ini "gopkg.in/ini.v1"
1919
)
@@ -97,7 +97,11 @@ func runEnvironmentToIni(c *cli.Context) error {
9797
setting.SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath)
9898

9999
cfg := ini.Empty()
100-
if com.IsFile(setting.CustomConf) {
100+
isFile, err := util.IsFile(setting.CustomConf)
101+
if err != nil {
102+
log.Fatal("Unable to check if %s is a file. Error: %v", setting.CustomConf, err)
103+
}
104+
if isFile {
101105
if err := cfg.Append(setting.CustomConf); err != nil {
102106
log.Fatal("Failed to load custom conf '%s': %v", setting.CustomConf, err)
103107
}
@@ -145,7 +149,7 @@ func runEnvironmentToIni(c *cli.Context) error {
145149
if len(destination) == 0 {
146150
destination = setting.CustomConf
147151
}
148-
err := cfg.SaveTo(destination)
152+
err = cfg.SaveTo(destination)
149153
if err != nil {
150154
return err
151155
}

0 commit comments

Comments
 (0)