Skip to content

Commit

Permalink
Merge branch 'main' into cache-last-commit-data-as-found
Browse files Browse the repository at this point in the history
  • Loading branch information
zeripath authored Aug 3, 2021
2 parents c644779 + 35735bb commit b8693a4
Show file tree
Hide file tree
Showing 26 changed files with 283 additions and 100 deletions.
16 changes: 8 additions & 8 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ trigger:
steps:
- name: deps-frontend
pull: always
image: node:16
image: node:14
commands:
- make node_modules

- name: lint-frontend
image: node:16
image: node:14
commands:
- make lint-frontend
depends_on: [deps-frontend]
Expand Down Expand Up @@ -58,7 +58,7 @@ steps:
TAGS: bindata gogit sqlite sqlite_unlock_notify

- name: checks-frontend
image: node:16
image: node:14
commands:
- make checks-frontend
depends_on: [deps-frontend]
Expand All @@ -71,20 +71,20 @@ steps:
depends_on: [lint-backend]

- name: test-frontend
image: node:16
image: node:14
commands:
- make test-frontend
depends_on: [lint-frontend]

- name: build-frontend
image: node:16
image: node:14
commands:
- make frontend
depends_on: [test-frontend]

- name: build-backend-no-gcc
pull: always
image: golang:1.14 # this step is kept as the lowest version of golang that we support
image: golang:1.16 # this step is kept as the lowest version of golang that we support
environment:
GO111MODULE: on
GOPROXY: off
Expand Down Expand Up @@ -514,7 +514,7 @@ steps:
pull: always
image: techknowlogick/xgo:go-1.16.x
commands:
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
- export PATH=$PATH:$GOPATH/bin
- make release
environment:
Expand Down Expand Up @@ -610,7 +610,7 @@ steps:
pull: always
image: techknowlogick/xgo:go-1.16.x
commands:
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
- export PATH=$PATH:$GOPATH/bin
- make release
environment:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
COMMA := ,

XGO_VERSION := go-1.16.x
MIN_GO_VERSION := 001014000
MIN_GO_VERSION := 001016000
MIN_NODE_VERSION := 012017000

DOCKER_IMAGE ?= gitea/gitea
Expand Down Expand Up @@ -200,7 +200,7 @@ help:
go-check:
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');))
@if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \
echo "Gitea requires Go 1.14 or greater to build. You can get it at https://golang.org/dl/"; \
echo "Gitea requires Go 1.16 or greater to build. You can get it at https://golang.org/dl/"; \
exit 1; \
fi

Expand Down
2 changes: 1 addition & 1 deletion docs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ params:
author: The Gitea Authors
website: https://docs.gitea.io
version: 1.14.5
minGoVersion: 1.14
minGoVersion: 1.16
goVersion: 1.16
minNodeVersion: 12.17

Expand Down
2 changes: 1 addition & 1 deletion docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
- `LANDING_PAGE`: **home**: Landing page for unauthenticated users \[home, explore, organizations, login\].

- `LFS_START_SERVER`: **false**: Enables git-lfs support.
- `LFS_CONTENT_PATH`: **%(APP_DATA_PATH)/lfs**: DEPRECATED: Default LFS content path. (if it is on local storage.)
- `LFS_CONTENT_PATH`: **%(APP_DATA_PATH)/lfs**: Default LFS content path. (if it is on local storage.) **DEPRECATED** use settings in `[lfs]`.
- `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string.
- `LFS_HTTP_AUTH_EXPIRY`: **20m**: LFS authentication validity period in time.Duration, pushes taking longer than this may fail.
- `LFS_MAX_FILE_SIZE`: **0**: Maximum allowed LFS file size in bytes (Set to 0 for no limit).
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
github.com/gogs/chardet v0.0.0-20191104214054-4b6791f73a28
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85
github.com/golang-jwt/jwt v3.2.1+incompatible
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-github/v32 v32.1.0
github.com/google/go-querystring v1.1.0 // indirect
Expand Down Expand Up @@ -143,3 +143,5 @@ require (
)

replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

replace github.com/golang-jwt/jwt v3.2.1+incompatible => github.com/golang-jwt/jwt v3.2.2+incompatible
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e h1:YjaQU6XFicdhPN+Ml
gitea.com/go-chi/captcha v0.0.0-20210110083842-e7696c336a1e/go.mod h1:nfA7JaGv3hbGQ1ktdhAsZhdS84qKffI8NMlHr+Opsog=
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee h1:9U6HuKUBt/cGK6T/64dEuz0r7Yp97WAAEJvXHDlY3ws=
gitea.com/go-chi/session v0.0.0-20210108030337-0cb48c5ba8ee/go.mod h1:Ozg8IchVNb/Udg+ui39iHRYqVHSvf3C99ixdpLR8Vu0=
gitea.com/lunny/levelqueue v0.3.0 h1:MHn1GuSZkxvVEDMyAPqlc7A3cOW+q8RcGhRgH/xtm6I=
gitea.com/lunny/levelqueue v0.3.0/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU=
gitea.com/lunny/levelqueue v0.4.0 h1:v+bCR1lwLTBpZMshguWNhGIFLkUj+R04pgaU3TcJFS8=
gitea.com/lunny/levelqueue v0.4.0/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU=
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
Expand Down Expand Up @@ -477,8 +475,8 @@ github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14 h1:yXtpJr/LV6PFu4nTLgfjQ
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14/go.mod h1:jPoNZLWDAqA5N3G5amEoiNbhVrmM+ZQEcnQvNQ2KaZk=
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 h1:UjoPNDAQ5JPCjlxoJd6K8ALZqSDDhk2ymieAZOVaDg0=
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85/go.mod h1:fR6z1Ie6rtF7kl/vBYMfgD5/G5B1blui7z426/sj2DU=
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
4 changes: 3 additions & 1 deletion modules/markup/markdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ func newParserContext(ctx *markup.RenderContext) parser.Context {
func actualRender(ctx *markup.RenderContext, input io.Reader, output io.Writer) error {
once.Do(func() {
converter = goldmark.New(
goldmark.WithExtensions(extension.Table,
goldmark.WithExtensions(
extension.NewTable(
extension.WithTableCellAlignMethod(extension.TableCellAlignAttribute)),
extension.Strikethrough,
extension.TaskList,
extension.DefinitionList,
Expand Down
8 changes: 4 additions & 4 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1437,10 +1437,10 @@ pulls.no_merge_helper = Enable merge options in the repository settings or merge
pulls.no_merge_wip = This pull request can not be merged because it is marked as being a work in progress.
pulls.no_merge_not_ready = This pull request is not ready to be merged, check review status and status checks.
pulls.no_merge_access = You are not authorized to merge this pull request.
pulls.merge_pull_request = Merge Pull Request
pulls.rebase_merge_pull_request = Rebase and Merge
pulls.rebase_merge_commit_pull_request = Rebase and Merge (--no-ff)
pulls.squash_merge_pull_request = Squash and Merge
pulls.merge_pull_request = Create merge commit
pulls.rebase_merge_pull_request = Rebase then fast-forward
pulls.rebase_merge_commit_pull_request = Rebase then create merge commit
pulls.squash_merge_pull_request = Create squash commit
pulls.merge_manually = Manually merged
pulls.merge_commit_id = The merge commit ID
pulls.require_signed_wont_sign = The branch requires signed commits but this merge will not be signed
Expand Down
1 change: 1 addition & 0 deletions options/locale/locale_ja-JP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ editor.require_signed_commit=ブランチでは署名されたコミットが必
commits.desc=ソースコードの変更履歴を参照します。
commits.commits=コミット
commits.no_commits=共通のコミットはありません。 '%s''%s' の履歴はすべて異なっています。
commits.nothing_to_compare=二つのブランチは同じ内容です。
commits.search=コミットの検索…
commits.search.tooltip=キーワード "author:""committer:""after:""before:" を付けて指定できます。 例 "revert author:Alice before:2019-04-01"
commits.find=検索
Expand Down
5 changes: 3 additions & 2 deletions options/locale/locale_pt-PT.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ editor.require_signed_commit=O ramo requer um cometimento assinado
commits.desc=Navegar pelo histórico de modificações no código fonte.
commits.commits=Cometimentos
commits.no_commits=Não há cometimentos em comum. '%s' e '%s' têm históricos completamente diferentes.
commits.nothing_to_compare=Estes ramos são iguais.
commits.search=Procurar cometimentos…
commits.search.tooltip=Pode prefixar palavras-chave com "author:", "committer:", "after:", ou "before:". Por exemplo: "revert author:Alice before:2019-04-01".
commits.find=Procurar
Expand Down Expand Up @@ -1828,8 +1829,8 @@ settings.event_pull_request_review=Pedido de integração revisto
settings.event_pull_request_review_desc=Pedido de integração aprovado, rejeitado ou comentado na revisão.
settings.event_pull_request_sync=Pedido de integração sincronizado
settings.event_pull_request_sync_desc=Pedido de integração sincronizado.
settings.branch_filter=Filtro por ramo
settings.branch_filter_desc=Lista de permissões do ramo para eventos de envio e de criação e eliminação de ramos, especificada como um padrão glob. Se estiver em branco ou for <code>*</code>, serão reportados eventos para todos os ramos. Veja a documentação <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> para ver os detalhes da sintaxe. Exemplos: <code>trunk</code>, <code>{trunk,release*}</code>.
settings.branch_filter=Filtro de ramos
settings.branch_filter_desc=Lista dos ramos a serem considerados nos eventos de envio e de criação e eliminação de ramos, especificada como um padrão glob. Se estiver em branco ou for <code>*</code>, serão reportados eventos para todos os ramos. Veja a documentação <a href="https://pkg.go.dev/github.com/gobwas/glob#Compile">github.com/gobwas/glob</a> para ver os detalhes da sintaxe. Exemplos: <code>trunk</code>, <code>{trunk,release*}</code>.
settings.active=Em funcionamento
settings.active_helper=Informação sobre eventos despoletados será enviada para o URL deste automatismo web.
settings.add_hook_success=O automatismo web foi adicionado.
Expand Down
2 changes: 1 addition & 1 deletion routers/api/v1/repo/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func UpdateTopics(ctx *context.APIContext) {

// AddTopic adds a topic name to a repo
func AddTopic(ctx *context.APIContext) {
// swagger:operation PUT /repos/{owner}/{repo}/topics/{topic} repository repoAddTopíc
// swagger:operation PUT /repos/{owner}/{repo}/topics/{topic} repository repoAddTopic
// ---
// summary: Add a topic to a repository
// produces:
Expand Down
7 changes: 7 additions & 0 deletions routers/api/v1/swagger/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ type swaggerResponseOAuth2Application struct {
// in:body
Body api.OAuth2Application `json:"body"`
}

// AccessToken represents an API access token.
// swagger:response AccessToken
type swaggerResponseAccessToken struct {
// in:body
Body api.AccessToken `json:"body"`
}
3 changes: 3 additions & 0 deletions routers/api/v1/swagger/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ type swaggerParameterBodies struct {
// in:body
CreateTagOption api.CreateTagOption

// in:body
CreateAccessTokenOption api.CreateAccessTokenOption

// in:body
UserSettingsOptions api.UserSettingsOptions
}
9 changes: 2 additions & 7 deletions routers/api/v1/user/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,10 @@ func CreateAccessToken(ctx *context.APIContext) {
// description: username of user
// type: string
// required: true
// - name: accessToken
// - name: userCreateToken
// in: body
// schema:
// type: object
// required:
// - name
// properties:
// name:
// type: string
// "$ref": "#/definitions/CreateAccessTokenOption"
// responses:
// "201":
// "$ref": "#/responses/AccessToken"
Expand Down
3 changes: 3 additions & 0 deletions services/wiki/wiki.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ func prepareWikiFileName(gitRepo *git.Repository, wikiName string) (bool, string
// Look for both files
filesInIndex, err := gitRepo.LsTree("master", unescaped, escaped)
if err != nil {
if strings.Contains(err.Error(), "Not a valid object name master") {
return false, escaped, nil
}
log.Error("%v", err)
return false, escaped, err
}
Expand Down
29 changes: 29 additions & 0 deletions services/wiki/wiki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
package wiki

import (
"io/ioutil"
"os"
"path/filepath"
"testing"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/util"

"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -261,3 +265,28 @@ func TestPrepareWikiFileName(t *testing.T) {
})
}
}

func TestPrepareWikiFileName_FirstPage(t *testing.T) {
models.PrepareTestEnv(t)

// Now create a temporaryDirectory
tmpDir, err := ioutil.TempDir("", "empty-wiki")
assert.NoError(t, err)
defer func() {
if _, err := os.Stat(tmpDir); !os.IsNotExist(err) {
_ = util.RemoveAll(tmpDir)
}
}()

err = git.InitRepository(tmpDir, true)
assert.NoError(t, err)

gitRepo, err := git.OpenRepository(tmpDir)
defer gitRepo.Close()
assert.NoError(t, err)

existence, newWikiPath, err := prepareWikiFileName(gitRepo, "Home")
assert.False(t, existence)
assert.NoError(t, err)
assert.Equal(t, "Home.md", newWikiPath)
}
41 changes: 16 additions & 25 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9651,7 +9651,7 @@
"repository"
],
"summary": "Add a topic to a repository",
"operationId": "repoAddTopíc",
"operationId": "repoAddTopic",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -11917,18 +11917,10 @@
"required": true
},
{
"name": "accessToken",
"name": "userCreateToken",
"in": "body",
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
}
"$ref": "#/definitions/CreateAccessTokenOption"
}
}
],
Expand Down Expand Up @@ -12654,6 +12646,17 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateAccessTokenOption": {
"description": "CreateAccessTokenOption options when create access token",
"type": "object",
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateBranchProtectionOption": {
"description": "CreateBranchProtectionOption options for creating a branch protection",
"type": "object",
Expand Down Expand Up @@ -17045,20 +17048,8 @@
"responses": {
"AccessToken": {
"description": "AccessToken represents an API access token.",
"headers": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"sha1": {
"type": "string"
},
"token_last_eight": {
"type": "string"
}
"schema": {
"$ref": "#/definitions/AccessToken"
}
},
"AccessTokenList": {
Expand Down
11 changes: 0 additions & 11 deletions vendor/github.com/golang-jwt/jwt/.travis.yml

This file was deleted.

9 changes: 8 additions & 1 deletion vendor/github.com/golang-jwt/jwt/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b8693a4

Please sign in to comment.