Skip to content

Commit 6660f9a

Browse files
committed
Merge branch 'main' into enable-spellcheck-easymde
2 parents 2d9d442 + 3ba0910 commit 6660f9a

File tree

657 files changed

+14535
-13624
lines changed

Some content is hidden

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

657 files changed

+14535
-13624
lines changed

.drone.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ steps:
109109
depends_on: [test-frontend]
110110

111111
- name: build-backend-no-gcc
112-
image: golang:1.17 # this step is kept as the lowest version of golang that we support
112+
image: golang:1.18 # this step is kept as the lowest version of golang that we support
113113
pull: always
114114
environment:
115115
GO111MODULE: on
@@ -331,7 +331,7 @@ steps:
331331
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
332332
user: gitea
333333
commands:
334-
- timeout -s ABRT 40m make test-mysql8-migration test-mysql8
334+
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
335335
environment:
336336
GOPROXY: https://goproxy.io
337337
TAGS: bindata
@@ -469,7 +469,7 @@ steps:
469469
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
470470
user: gitea
471471
commands:
472-
- timeout -s ABRT 40m make test-sqlite-migration test-sqlite
472+
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite
473473
environment:
474474
GOPROXY: https://goproxy.io
475475
TAGS: bindata gogit sqlite sqlite_unlock_notify
@@ -485,7 +485,7 @@ steps:
485485
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
486486
user: gitea
487487
commands:
488-
- timeout -s ABRT 40m make test-pgsql-migration test-pgsql
488+
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
489489
environment:
490490
GOPROXY: https://goproxy.io
491491
TAGS: bindata gogit

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ contact_links:
44
url: https://tinyurl.com/security-gitea
55
about: For security concerns, please send a mail to [email protected] instead of opening a public issue.
66
- name: Discord Server
7-
url: https://discord.gg/gitea
7+
url: https://discord.gg/Gitea
88
about: Please ask questions and discuss configuration or deployment problems here.
99
- name: Discourse Forum
1010
url: https://discourse.gitea.io

.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

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.18-alpine3.15 AS build-env
2+
FROM golang:1.18-alpine3.16 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2323
# Begin env-to-ini build
2424
RUN go build contrib/environment-to-ini/environment-to-ini.go
2525

26-
FROM alpine:3.15
26+
FROM alpine:3.16
2727
LABEL maintainer="[email protected]"
2828

2929
EXPOSE 22 3000

Dockerfile.rootless

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.18-alpine3.15 AS build-env
2+
FROM golang:1.18-alpine3.16 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}
@@ -23,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2323
# Begin env-to-ini build
2424
RUN go build contrib/environment-to-ini/environment-to-ini.go
2525

26-
FROM alpine:3.15
26+
FROM alpine:3.16
2727
LABEL maintainer="[email protected]"
2828

2929
EXPOSE 2222 3000

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ Steven Kriegler <[email protected]> (@justusbunsi)
4545
Jimmy Praet <[email protected]> (@jpraet)
4646
Leon Hofmeister <[email protected]> (@delvh)
4747
Gusted <[email protected]) (@Gusted)
48-
singuliere <[email protected]> (@singuliere)
48+
silentcode <[email protected]> (@silentcodeg)
49+
Wim <[email protected]> (@42wim)

Makefile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ help:
195195
@echo " - swagger-validate check if the swagger spec is valid"
196196
@echo " - golangci-lint run golangci-lint linter"
197197
@echo " - vet examines Go source code and reports suspicious constructs"
198+
@echo " - tidy run go mod tidy"
198199
@echo " - test[\#TestSpecificName] run unit test"
199200
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
200201
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
@@ -369,16 +370,20 @@ unit-test-coverage:
369370
@echo "Running unit-test-coverage $(GOTESTFLAGS) -tags '$(TEST_TAGS)'..."
370371
@$(GO) test $(GOTESTFLAGS) -timeout=20m -tags='$(TEST_TAGS)' -cover -coverprofile coverage.out $(GO_PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
371372

373+
.PHONY: tidy
374+
tidy:
375+
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
376+
$(GO) mod tidy -compat=$(MIN_GO_VERSION)
377+
372378
.PHONY: vendor
373-
vendor:
374-
$(GO) mod tidy && $(GO) mod vendor
379+
vendor: tidy
380+
$(GO) mod vendor
375381

376382
.PHONY: gomod-check
377-
gomod-check:
378-
@$(GO) mod tidy
383+
gomod-check: tidy
379384
@diff=$$(git diff go.sum); \
380385
if [ -n "$$diff" ]; then \
381-
echo "Please run '$(GO) mod tidy' and commit the result:"; \
386+
echo "Please run 'make tidy' and commit the result:"; \
382387
echo "$${diff}"; \
383388
exit 1; \
384389
fi
@@ -611,27 +616,27 @@ release-windows: | $(DIST_DIRS)
611616
ifeq (,$(findstring gogit,$(TAGS)))
612617
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'netgo osusergo gogit $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
613618
endif
614-
ifeq ($(CI),drone)
619+
ifeq ($(CI),true)
615620
cp /build/* $(DIST)/binaries
616621
endif
617622

618623
.PHONY: release-linux
619624
release-linux: | $(DIST_DIRS)
620625
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
621-
ifeq ($(CI),drone)
626+
ifeq ($(CI),true)
622627
cp /build/* $(DIST)/binaries
623628
endif
624629

625630
.PHONY: release-darwin
626631
release-darwin: | $(DIST_DIRS)
627632
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
628-
ifeq ($(CI),drone)
633+
ifeq ($(CI),true)
629634
cp /build/* $(DIST)/binaries
630635
endif
631636

632637
.PHONY: release-copy
633638
release-copy: | $(DIST_DIRS)
634-
cd $(DIST); for file in `find /build -type f -name "*"`; do cp $${file} ./release/; done;
639+
cd $(DIST); for file in `find . -type f -name "*"`; do cp $${file} ./release/; done;
635640

636641
.PHONY: release-check
637642
release-check: | $(DIST_DIRS)
@@ -698,8 +703,8 @@ fomantic:
698703
cd $(FOMANTIC_WORK_DIR) && npm install --no-save
699704
cp -f $(FOMANTIC_WORK_DIR)/theme.config.less $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/theme.config
700705
cp -rf $(FOMANTIC_WORK_DIR)/_site $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/
701-
cp -f web_src/js/vendor/dropdown.js $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui/src/definitions/modules
702706
cd $(FOMANTIC_WORK_DIR) && npx gulp -f node_modules/fomantic-ui/gulpfile.js build
707+
$(SED_INPLACE) -e 's/\r//g' $(FOMANTIC_WORK_DIR)/build/semantic.css $(FOMANTIC_WORK_DIR)/build/semantic.js
703708
rm -f $(FOMANTIC_WORK_DIR)/build/*.min.*
704709

705710
.PHONY: webpack
@@ -757,7 +762,7 @@ generate-gitignore:
757762

758763
.PHONY: generate-images
759764
generate-images: | node_modules
760-
npm install --no-save --no-package-lock fabric@4 imagemin-zopfli@7
765+
npm install --no-save --no-package-lock fabric@5 imagemin-zopfli@7
761766
node build/generate-images.js $(TAGS)
762767

763768
.PHONY: generate-manpage

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ or if SQLite support is required:
7373

7474
The `build` target is split into two sub-targets:
7575

76-
- `make backend` which requires [Go 1.17](https://go.dev/dl/) or greater.
76+
- `make backend` which requires [Go Stable](https://go.dev/dl/), required version is defined in [go.mod](/go.mod).
7777
- `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.

assets/favicon.svg

Lines changed: 31 additions & 0 deletions
Loading

build/generate-images.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1+
#!/usr/bin/env node
12
import imageminZopfli from 'imagemin-zopfli';
23
import {optimize} from 'svgo';
34
import {fabric} from 'fabric';
4-
import fs from 'fs';
5-
import {resolve, dirname} from 'path';
6-
import {fileURLToPath} from 'url';
7-
8-
const {readFile, writeFile} = fs.promises;
9-
const __dirname = dirname(fileURLToPath(import.meta.url));
10-
const logoFile = resolve(__dirname, '../assets/logo.svg');
5+
import {readFile, writeFile} from 'fs/promises';
116

127
function exit(err) {
138
if (err) console.error(err);
@@ -22,8 +17,10 @@ function loadSvg(svg) {
2217
});
2318
}
2419

25-
async function generate(svg, outputFile, {size, bg}) {
26-
if (outputFile.endsWith('.svg')) {
20+
async function generate(svg, path, {size, bg}) {
21+
const outputFile = new URL(path, import.meta.url);
22+
23+
if (String(outputFile).endsWith('.svg')) {
2724
const {data} = optimize(svg, {
2825
plugins: [
2926
'preset-default',
@@ -68,17 +65,18 @@ async function generate(svg, outputFile, {size, bg}) {
6865

6966
async function main() {
7067
const gitea = process.argv.slice(2).includes('gitea');
71-
const svg = await readFile(logoFile, 'utf8');
68+
const logoSvg = await readFile(new URL('../assets/logo.svg', import.meta.url), 'utf8');
69+
const faviconSvg = await readFile(new URL('../assets/favicon.svg', import.meta.url), 'utf8');
7270

7371
await Promise.all([
74-
generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
75-
generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
76-
generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
77-
generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
78-
generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
79-
gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
72+
generate(logoSvg, '../public/img/logo.svg', {size: 32}),
73+
generate(logoSvg, '../public/img/logo.png', {size: 512}),
74+
generate(faviconSvg, '../public/img/favicon.svg', {size: 32}),
75+
generate(faviconSvg, '../public/img/favicon.png', {size: 180}),
76+
generate(logoSvg, '../public/img/avatar_default.png', {size: 200}),
77+
generate(logoSvg, '../public/img/apple-touch-icon.png', {size: 180, bg: true}),
78+
gitea && generate(logoSvg, '../public/img/gitea.svg', {size: 32}),
8079
]);
8180
}
8281

8382
main().then(exit).catch(exit);
84-

build/generate-svg.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
#!/usr/bin/env node
12
import fastGlob from 'fast-glob';
23
import {optimize} from 'svgo';
3-
import {resolve, parse, dirname} from 'path';
4-
import fs from 'fs';
4+
import {parse} from 'path';
5+
import {readFile, writeFile, mkdir} from 'fs/promises';
56
import {fileURLToPath} from 'url';
67

7-
const {readFile, writeFile, mkdir} = fs.promises;
8-
const __dirname = dirname(fileURLToPath(import.meta.url));
9-
const glob = (pattern) => fastGlob.sync(pattern, {cwd: resolve(__dirname), absolute: true});
10-
const outputDir = resolve(__dirname, '../public/img/svg');
8+
const glob = (pattern) => fastGlob.sync(pattern, {
9+
cwd: fileURLToPath(new URL('..', import.meta.url)),
10+
absolute: true,
11+
});
1112

1213
function exit(err) {
1314
if (err) console.error(err);
@@ -16,7 +17,6 @@ function exit(err) {
1617

1718
async function processFile(file, {prefix, fullName} = {}) {
1819
let name;
19-
2020
if (fullName) {
2121
name = fullName;
2222
} else {
@@ -35,7 +35,8 @@ async function processFile(file, {prefix, fullName} = {}) {
3535
{name: 'addAttributesToSVGElement', params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]}},
3636
],
3737
});
38-
await writeFile(resolve(outputDir, `${name}.svg`), data);
38+
39+
await writeFile(fileURLToPath(new URL(`../public/img/svg/${name}.svg`, import.meta.url)), data);
3940
}
4041

4142
function processFiles(pattern, opts) {
@@ -44,15 +45,14 @@ function processFiles(pattern, opts) {
4445

4546
async function main() {
4647
try {
47-
await mkdir(outputDir);
48+
await mkdir(fileURLToPath(new URL('../public/img/svg', import.meta.url)), {recursive: true});
4849
} catch {}
4950

5051
await Promise.all([
51-
...processFiles('../node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
52-
...processFiles('../web_src/svg/*.svg'),
53-
...processFiles('../public/img/gitea.svg', {fullName: 'gitea-gitea'}),
52+
...processFiles('node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
53+
...processFiles('web_src/svg/*.svg'),
54+
...processFiles('public/img/gitea.svg', {fullName: 'gitea-gitea'}),
5455
]);
5556
}
5657

5758
main().then(exit).catch(exit);
58-

cmd/admin.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
asymkey_model "code.gitea.io/gitea/models/asymkey"
1818
"code.gitea.io/gitea/models/auth"
1919
"code.gitea.io/gitea/models/db"
20+
repo_model "code.gitea.io/gitea/models/repo"
2021
user_model "code.gitea.io/gitea/models/user"
2122
"code.gitea.io/gitea/modules/git"
2223
"code.gitea.io/gitea/modules/graceful"
@@ -722,9 +723,9 @@ func runRepoSyncReleases(_ *cli.Context) error {
722723

723724
log.Trace("Synchronizing repository releases (this may take a while)")
724725
for page := 1; ; page++ {
725-
repos, count, err := models.SearchRepositoryByName(&models.SearchRepoOptions{
726+
repos, count, err := repo_model.SearchRepositoryByName(&repo_model.SearchRepoOptions{
726727
ListOptions: db.ListOptions{
727-
PageSize: models.RepositoryListDefaultPageSize,
728+
PageSize: repo_model.RepositoryListDefaultPageSize,
728729
Page: page,
729730
},
730731
Private: true,

0 commit comments

Comments
 (0)