Skip to content

Commit 25c3a01

Browse files
committed
Merge branch 'master' of https://github.com/go-gitea/gitea into fix-lfs-server
2 parents 2b0a713 + c29620c commit 25c3a01

Some content is hidden

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

71 files changed

+929
-370
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ insert_final_newline = false
1818
[templates/swagger/v1_json.tmpl]
1919
indent_style = space
2020

21+
[templates/user/auth/oidc_wellknown.tmpl]
22+
indent_style = space
23+
2124
[Makefile]
2225
indent_style = tab
2326

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ _testmain.go
3232

3333
*coverage.out
3434
coverage.all
35+
cpu.out
3536

3637
/modules/options/bindata.go
3738
/modules/options/bindata.go.hash

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@ 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.14.1](https://github.com/go-gitea/gitea/releases/tag/v1.14.1) - 2021-04-15
8+
9+
* BUGFIXES
10+
* Fix bug clone wiki (#15499) (#15502)
11+
* Github Migration ignore rate limit, if not enabled (#15490) (#15495)
12+
* Use subdir for URL (#15446) (#15493)
13+
* Query the DB for the hash before inserting in to email_hash (#15457) (#15491)
14+
* Ensure review dismissal only dismisses the correct review (#15477) (#15489)
15+
* Use index of the supported tags to choose user lang (#15452) (#15488)
16+
* Fix wrong file link in code search page (#15466) (#15486)
17+
* Quick template fix for built-in SSH server in admin config (#15464) (#15481)
18+
* Prevent superfluous response.WriteHeader (#15456) (#15476)
19+
* Fix ambiguous argument error on tags (#15432) (#15474)
20+
* Add created_unix instead of expiry to migration (#15458) (#15463)
21+
* Fix repository search (#15428) (#15442)
22+
* Prevent NPE on avatar direct rendering if federated avatars disabled (#15434) (#15439)
23+
* Fix wiki clone urls (#15430) (#15431)
24+
* Fix dingtalk icon url at webhook (#15417) (#15426)
25+
* Standardise icon on projects PR page (#15387) (#15408)
26+
* ENHANCEMENTS
27+
* Add option to skip LFS/attachment files for `dump` (#15407) (#15492)
28+
* Clone panel fixes (#15436)
29+
* Use semantic dropdown for code search query type (#15276) (#15364)
30+
* BUILD
31+
* Build go-git variants for windows (#15482) (#15487)
32+
* Lock down build-images dependencies (Partial #15479) (#15480)
33+
* MISC
34+
* Performance improvement for list pull requests (#15447) (#15500)
35+
* Fix potential copy lfs records failure when fork a repository (#15441) (#15485)
36+
737
## [1.14.0](https://github.com/go-gitea/gitea/releases/tag/v1.14.0) - 2021-04-11
838

939
* SECURITY

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,9 @@ release-windows: | $(DIST_DIRS)
613613
$(GO) install src.techknowlogick.com/xgo@latest; \
614614
fi
615615
CGO_CFLAGS="$(CGO_CFLAGS)" xgo -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
616+
ifeq (,$(findstring gogit,$(TAGS)))
617+
CGO_CFLAGS="$(CGO_CFLAGS)" xgo -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 .
618+
endif
616619
ifeq ($(CI),drone)
617620
cp /build/* $(DIST)/binaries
618621
endif
@@ -733,8 +736,8 @@ generate-gitignore:
733736
GO111MODULE=on $(GO) run build/generate-gitignores.go
734737

735738
.PHONY: generate-images
736-
generate-images:
737-
npm install --no-save --no-package-lock fabric imagemin-zopfli
739+
generate-images: | node_modules
740+
npm install --no-save --no-package-lock fabric@4 imagemin-zopfli@7
738741
node build/generate-images.js $(TAGS)
739742

740743
.PHONY: generate-manpage

build/generate-images.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import imageminZopfli from 'imagemin-zopfli';
22
import {optimize, extendDefaultPlugins} from 'svgo';
33
import {fabric} from 'fabric';
4-
import {readFile, writeFile} from 'fs/promises';
4+
import fs from 'fs';
55
import {resolve, dirname} from 'path';
66
import {fileURLToPath} from 'url';
77

8+
const {readFile, writeFile} = fs.promises;
89
const __dirname = dirname(fileURLToPath(import.meta.url));
910
const logoFile = resolve(__dirname, '../assets/logo.svg');
1011

build/generate-svg.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import fastGlob from 'fast-glob';
22
import {optimize, extendDefaultPlugins} from 'svgo';
33
import {resolve, parse, dirname} from 'path';
4-
import {readFile, writeFile, mkdir} from 'fs/promises';
4+
import fs from 'fs';
55
import {fileURLToPath} from 'url';
66

7+
const {readFile, writeFile, mkdir} = fs.promises;
78
const __dirname = dirname(fileURLToPath(import.meta.url));
89
const glob = (pattern) => fastGlob.sync(pattern, {cwd: resolve(__dirname), absolute: true});
910
const outputDir = resolve(__dirname, '../public/img/svg');

custom/conf/app.example.ini

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PROJECT_BOARD_BASIC_KANBAN_TYPE = To Do, In Progress, Done
1919
PROJECT_BOARD_BUG_TRIAGE_TYPE = Needs Triage, High Priority, Low Priority, Closed
2020

2121
[repository]
22-
; Root path for storing all repository data. It must be an absolute path. By default it is stored in a sub-directory of `APP_DATA_PATH`.
22+
; Root path for storing all repository data. It must be an absolute path. By default, it is stored in a sub-directory of `APP_DATA_PATH`.
2323
ROOT =
2424
; The script type this server supports. Usually this is `bash`, but some users report that only `sh` is available.
2525
SCRIPT_TYPE = bash
@@ -48,7 +48,7 @@ PREFERRED_LICENSES = Apache License 2.0,MIT License
4848
; Disable the ability to interact with repositories using the HTTP protocol
4949
DISABLE_HTTP_GIT = false
5050
; Value for Access-Control-Allow-Origin header, default is not to present
51-
; WARNING: This maybe harmful to you website if you do not give it a right value.
51+
; WARNING: This may be harmful to your website if you do not give it a right value.
5252
ACCESS_CONTROL_ALLOW_ORIGIN =
5353
; Force ssh:// clone url instead of scp-style uri when default SSH port is used
5454
USE_COMPAT_SSH_URI = false
@@ -70,6 +70,8 @@ PREFIX_ARCHIVE_FILES = true
7070
DISABLE_MIRRORS = false
7171
; Disable migrating feature.
7272
DISABLE_MIGRATIONS = false
73+
; Disable stars feature.
74+
DISABLE_STARS = false
7375
; The default branch name of new repositories
7476
DEFAULT_BRANCH = master
7577
; Allow adoption of unadopted repositories
@@ -134,7 +136,7 @@ ALLOWED_TYPES =
134136
SIGNING_KEY = default
135137
; If a SIGNING_KEY ID is provided and is not set to default, use the provided Name and Email address as the signer.
136138
; These should match a publicized name and email address for the key. (When SIGNING_KEY is default these are set to
137-
; the results of git config --get user.name and git config --get user.email respectively and can only be overrided
139+
; the results of git config --get user.name and git config --get user.email respectively and can only be overridden
138140
; by setting the SIGNING_KEY ID to the correct ID.)
139141
SIGNING_NAME =
140142
SIGNING_EMAIL =
@@ -447,7 +449,7 @@ LOG_SQL = true
447449
DB_RETRIES = 10
448450
; Backoff time per DB retry (time.Duration)
449451
DB_RETRY_BACKOFF = 3s
450-
; Max idle database connections on connnection pool, default is 2
452+
; Max idle database connections on connection pool, default is 2
451453
MAX_IDLE_CONNS = 2
452454
; Database connection max life time, default is 0 or 3s mysql (See #6804 & #7071 for reasoning)
453455
CONN_MAX_LIFETIME = 3s
@@ -466,7 +468,7 @@ ISSUE_INDEXER_PATH = indexers/issues.bleve
466468
; Issue indexer queue, currently support: channel, levelqueue or redis, default is levelqueue
467469
ISSUE_INDEXER_QUEUE_TYPE = levelqueue
468470
; When ISSUE_INDEXER_QUEUE_TYPE is levelqueue, this will be the path where the queue will be saved.
469-
; This can be overriden by `ISSUE_INDEXER_QUEUE_CONN_STR`.
471+
; This can be overridden by `ISSUE_INDEXER_QUEUE_CONN_STR`.
470472
; default is indexers/issues.queue
471473
ISSUE_INDEXER_QUEUE_DIR = indexers/issues.queue
472474
; When `ISSUE_INDEXER_QUEUE_TYPE` is `redis`, this will store the redis connection string.
@@ -514,9 +516,9 @@ BATCH_LENGTH = 20
514516
; When `TYPE` is `persistable-channel`, this provides a directory for the underlying leveldb
515517
; or additional options of the form `leveldb://path/to/db?option=value&....`, and will override `DATADIR`.
516518
CONN_STR = "addrs=127.0.0.1:6379 db=0"
517-
; Provides the suffix of the default redis/disk queue name - specific queues can be overriden within in their [queue.name] sections.
519+
; Provides the suffix of the default redis/disk queue name - specific queues can be overridden within in their [queue.name] sections.
518520
QUEUE_NAME = "_queue"
519-
; Provides the suffix of the default redis/disk unique queue set name - specific queues can be overriden within in their [queue.name] sections.
521+
; Provides the suffix of the default redis/disk unique queue set name - specific queues can be overridden within in their [queue.name] sections.
520522
SET_NAME = "_unique"
521523
; If the queue cannot be created at startup - level queues may need a timeout at startup - wrap the queue:
522524
WRAP_IF_NECESSARY = true
@@ -617,6 +619,30 @@ WHITELISTED_URIS =
617619
; Example value: loadaverage.org/badguy stackexchange.com/.*spammer
618620
BLACKLISTED_URIS =
619621

622+
[oauth2_client]
623+
; Whether a new auto registered oauth2 user needs to confirm their email.
624+
; Do not include to use the REGISTER_EMAIL_CONFIRM setting from the `[service]` section.
625+
REGISTER_EMAIL_CONFIRM =
626+
; Scopes for the openid connect oauth2 provider (separated by space, the openid scope is implicitly added).
627+
; Typical values are profile and email.
628+
; For more information about the possible values see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
629+
OPENID_CONNECT_SCOPES =
630+
; Automatically create user accounts for new oauth2 users.
631+
ENABLE_AUTO_REGISTRATION = false
632+
; The source of the username for new oauth2 accounts:
633+
; userid = use the userid / sub attribute
634+
; nickname = use the nickname attribute
635+
; email = use the username part of the email attribute
636+
USERNAME = nickname
637+
; Update avatar if available from oauth2 provider.
638+
; Update will be performed on each login.
639+
UPDATE_AVATAR = false
640+
; How to handle if an account / email already exists:
641+
; disabled = show an error
642+
; login = show an account linking login
643+
; auto = link directly with the account
644+
ACCOUNT_LINKING = disabled
645+
620646
[service]
621647
; Time limit to confirm account/email registration
622648
ACTIVE_CODE_LIVE_MINUTES = 180
@@ -822,7 +848,7 @@ REPOSITORY_AVATAR_FALLBACK_IMAGE = /img/repo_default.png
822848
; This is to limit the amount of RAM used when resizing the image.
823849
AVATAR_MAX_WIDTH = 4096
824850
AVATAR_MAX_HEIGHT = 3072
825-
; Maximum alloved file size for uploaded avatars.
851+
; Maximum allowed file size for uploaded avatars.
826852
; This is to limit the amount of RAM used when resizing the image.
827853
AVATAR_MAX_FILE_SIZE = 1048576
828854
; Chinese users can choose "duoshuo"

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.14.0
21+
version: 1.14.1
2222
minGoVersion: 1.14
2323
goVersion: 1.16
2424
minNodeVersion: 12.17

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
7575
- `PREFIX_ARCHIVE_FILES`: **true**: Prefix archive files by placing them in a directory named after the repository.
7676
- `DISABLE_MIRRORS`: **false**: Disable the creation of **new** mirrors. Pre-existing mirrors remain valid.
7777
- `DISABLE_MIGRATIONS`: **false**: Disable migrating feature.
78+
- `DISABLE_STARS`: **false**: Disable stars feature.
7879
- `DEFAULT_BRANCH`: **master**: Default branch name of all repositories.
7980
- `ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES`: **false**: Allow non-admin users to adopt unadopted repositories
8081
- `ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES`: **false**: Allow non-admin users to delete unadopted repositories
@@ -429,6 +430,21 @@ relation to port exhaustion.
429430
- `BLACKLISTED_URIS`: **\<empty\>**: If non-empty, list of POSIX regex patterns matching
430431
OpenID URI's to block.
431432

433+
## OAuth2 Client (`oauth2_client`)
434+
435+
- `REGISTER_EMAIL_CONFIRM`: *[service]* **REGISTER\_EMAIL\_CONFIRM**: Set this to enable or disable email confirmation of OAuth2 auto-registration. (Overwrites the REGISTER\_EMAIL\_CONFIRM setting of the `[service]` section)
436+
- `OPENID_CONNECT_SCOPES`: **\<empty\>**: List of additional openid connect scopes. (`openid` is implicitly added)
437+
- `ENABLE_AUTO_REGISTRATION`: **false**: Automatically create user accounts for new oauth2 users.
438+
- `USERNAME`: **nickname**: The source of the username for new oauth2 accounts:
439+
- userid - use the userid / sub attribute
440+
- nickname - use the nickname attribute
441+
- email - use the username part of the email attribute
442+
- `UPDATE_AVATAR`: **false**: Update avatar if available from oauth2 provider. Update will be performed on each login.
443+
- `ACCOUNT_LINKING`: **disabled**: How to handle if an account / email already exists:
444+
- disabled - show an error
445+
- login - show an account linking login
446+
- auto - automatically link with the account (Please be aware that this will grant access to an existing account just because the same username or email is provided. You must make sure that this does not cause issues with your authentication providers.)
447+
432448
## Service (`service`)
433449

434450
- `ACTIVE_CODE_LIVE_MINUTES`: **180**: Time limit (min) to confirm account/email registration.
@@ -831,12 +847,14 @@ Gitea can support Markup using external tools. The example below will add a mark
831847
```ini
832848
[markup.asciidoc]
833849
ENABLED = true
850+
NEED_POSTPROCESS = true
834851
FILE_EXTENSIONS = .adoc,.asciidoc
835852
RENDER_COMMAND = "asciidoc --out-file=- -"
836853
IS_INPUT_FILE = false
837854
```
838855

839856
- ENABLED: **false** Enable markup support; set to **true** to enable this renderer.
857+
- NEED\_POSTPROCESS: **true** set to **true** to replace links / sha1 and etc.
840858
- FILE\_EXTENSIONS: **\<empty\>** List of file extensions that should be rendered by an external
841859
command. Multiple extentions needs a comma as splitter.
842860
- RENDER\_COMMAND: External command to render all matching extensions.

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,14 @@ test01.xls: application/vnd.ms-excel; charset=binary
297297
```ini
298298
[markup.asciidoc]
299299
ENABLED = false
300+
NEED_POSTPROCESS = true
300301
FILE_EXTENSIONS = .adoc,.asciidoc
301302
RENDER_COMMAND = "asciidoc --out-file=- -"
302303
IS_INPUT_FILE = false
303304
```
304305

305306
- ENABLED: 是否启用,默认为false。
307+
- NEED\_POSTPROCESS: **true** 设置为 true 则会替换渲染文件中的内部链接和Commit ID 等。
306308
- FILE_EXTENSIONS: 关联的文档的扩展名,多个扩展名用都好分隔。
307309
- RENDER_COMMAND: 工具的命令行命令及参数。
308310
- IS_INPUT_FILE: 输入方式是最后一个参数为文件路径还是从标准输入读取。

docs/content/doc/advanced/signing.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ when creating a repository. The possible values are:
109109
- `always`: Always sign
110110

111111
Options other than `never` and `always` can be combined as a comma
112-
separated list.
112+
separated list. The commit will be signed if all selected options are true.
113113

114114
### `WIKI`
115115

@@ -123,7 +123,7 @@ The possible values are:
123123
- `always`: Always sign
124124

125125
Options other than `never` and `always` can be combined as a comma
126-
separated list.
126+
separated list. The commit will be signed if all selected options are true.
127127

128128
### `CRUD_ACTIONS`
129129

@@ -137,7 +137,7 @@ editor or API CRUD actions. The possible values are:
137137
- `always`: Always sign
138138

139139
Options other than `never` and `always` can be combined as a comma
140-
separated list.
140+
separated list. The change will be signed if all selected options are true.
141141

142142
### `MERGES`
143143

@@ -154,7 +154,7 @@ The possible options are:
154154
- `always`: Always sign
155155

156156
Options other than `never` and `always` can be combined as a comma
157-
separated list.
157+
separated list. The merge will be signed if all selected options are true.
158158

159159
## Obtaining the Public Key of the Signing Key
160160

integrations/api_branch_test.go

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,28 @@ func testAPICreateBranches(t *testing.T, giteaURL *url.URL) {
151151
for _, test := range tests {
152152
defer resetFixtures(t)
153153
session := ctx.Session
154-
token := getTokenForLoggedInUser(t, session)
155-
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/my-noo-repo/branches?token="+token, &api.CreateBranchRepoOption{
156-
BranchName: test.NewBranch,
157-
OldBranchName: test.OldBranch,
158-
})
159-
resp := session.MakeRequest(t, req, test.ExpectedHTTPStatus)
160-
161-
var branch api.Branch
162-
DecodeJSON(t, resp, &branch)
163-
164-
if test.ExpectedHTTPStatus == http.StatusCreated {
165-
assert.EqualValues(t, test.NewBranch, branch.Name)
166-
}
154+
testAPICreateBranch(t, session, "user2", "my-noo-repo", test.OldBranch, test.NewBranch, test.ExpectedHTTPStatus)
167155
}
168156
}
169157

158+
func testAPICreateBranch(t testing.TB, session *TestSession, user, repo, oldBranch, newBranch string, status int) bool {
159+
token := getTokenForLoggedInUser(t, session)
160+
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/"+user+"/"+repo+"/branches?token="+token, &api.CreateBranchRepoOption{
161+
BranchName: newBranch,
162+
OldBranchName: oldBranch,
163+
})
164+
resp := session.MakeRequest(t, req, status)
165+
166+
var branch api.Branch
167+
DecodeJSON(t, resp, &branch)
168+
169+
if status == http.StatusCreated {
170+
assert.EqualValues(t, newBranch, branch.Name)
171+
}
172+
173+
return resp.Result().StatusCode == status
174+
}
175+
170176
func TestAPIBranchProtection(t *testing.T) {
171177
defer prepareTestEnv(t)()
172178

integrations/api_repo_file_create_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,36 @@ func getExpectedFileResponseForCreate(commitID, treePath string) *api.FileRespon
105105
}
106106
}
107107

108+
func BenchmarkAPICreateFileSmall(b *testing.B) {
109+
onGiteaRunTB(b, func(t testing.TB, u *url.URL) {
110+
b := t.(*testing.B)
111+
user2 := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) // owner of the repo1 & repo16
112+
repo1 := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository) // public repo
113+
114+
for n := 0; n < b.N; n++ {
115+
treePath := fmt.Sprintf("update/file%d.txt", n)
116+
createFileInBranch(user2, repo1, treePath, repo1.DefaultBranch, treePath)
117+
}
118+
})
119+
}
120+
121+
func BenchmarkAPICreateFileMedium(b *testing.B) {
122+
data := make([]byte, 10*1024*1024)
123+
124+
onGiteaRunTB(b, func(t testing.TB, u *url.URL) {
125+
b := t.(*testing.B)
126+
user2 := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) // owner of the repo1 & repo16
127+
repo1 := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository) // public repo
128+
129+
b.ResetTimer()
130+
for n := 0; n < b.N; n++ {
131+
treePath := fmt.Sprintf("update/file%d.txt", n)
132+
copy(data, treePath)
133+
createFileInBranch(user2, repo1, treePath, repo1.DefaultBranch, treePath)
134+
}
135+
})
136+
}
137+
108138
func TestAPICreateFile(t *testing.T) {
109139
onGiteaRun(t, func(t *testing.T, u *url.URL) {
110140
user2 := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User) // owner of the repo1 & repo16

0 commit comments

Comments
 (0)