Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge of upstream 'release' into G-Node/gogs 'master' #107

Merged
merged 164 commits into from
Dec 3, 2020
Merged
Changes from 1 commit
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
70e345c
templates: fix copypaste of email verification in reset_passwd (#5975)
KostyaEsmukov Mar 8, 2020
3e075f0
go.mod: update to Go 1.13 (#5976)
unknwon Mar 8, 2020
b2b7ba8
diff: remove misaligned space
unknwon Mar 8, 2020
effb9b1
commit: fix unexpected truncation in title
unknwon Mar 8, 2020
9da0466
templates: fix not able to upload issue attachments (#5978)
unknwon Mar 9, 2020
800906b
api: overhaul `/repos/owner/repos/contents` (#5980)
unknwon Mar 10, 2020
a89da51
ci: enable go vet check (#5981)
unknwon Mar 10, 2020
d69f65c
api: minor changes to `/repo/owner/repo/git/trees` (#5982)
unknwon Mar 10, 2020
2b3456b
all: clean up dot files (#5983)
unknwon Mar 10, 2020
e508308
api: group "/contents" with "" and "/*" #5985 (#5986)
bharatnc Mar 13, 2020
971e512
public: make lessc compile minimize CSS (#5987)
unknwon Mar 14, 2020
e12a86d
README: update link to local development
unknwon Mar 14, 2020
529694d
email: check the owner when set as primary (#5988)
unknwon Mar 15, 2020
042f31a
refactor: unify error handling in routing layer
unknwon Mar 15, 2020
345cdb5
util: add tests (#5989)
unknwon Mar 15, 2020
b92f7d8
locale: sync from Crowdin (#5991)
unknwon Mar 16, 2020
69cb408
ipynb: sanitize rendered HTML (#5996)
unknwon Mar 20, 2020
2a6cc3d
[templates] Conform to upstream indentation
mpsonntag Nov 26, 2020
f27ef19
admin: use POST to run operations (#5997)
unknwon Mar 21, 2020
1944425
workflows: enable golangci-lint (#5998)
unknwon Mar 21, 2020
d16c165
cmd: init logging before `SetEngine` (#6001)
unknwon Mar 22, 2020
0b4843e
webhook: overhaul route handlers (#6002)
unknwon Mar 22, 2020
ecd8be1
github: rename job name (#6004)
unknwon Mar 22, 2020
53ade9c
[ImgBot] Optimize images (#6005)
imgbot[bot] Mar 22, 2020
d02c113
locale: sync from Crowdin (#6006)
unknwon Mar 22, 2020
b8e5b10
http: always set header `X-Content-Type-Options` to `nosniff` (#6008)
unknwon Mar 23, 2020
1fb9dd6
cmd: backup support exclude mirror repositories (#6003)
Mar 24, 2020
72547ac
go.mod: update github.com/gogs/git-module (#6011)
unknwon Mar 25, 2020
907c3ca
csrf: set cookie HttpOnly and Secure (#6013)
unknwon Mar 26, 2020
72b7b35
build(deps): bump github.com/google/go-cmp from 0.3.0 to 0.4.0 (#6014)
dependabot-preview[bot] Mar 27, 2020
00b719b
build(deps): bump github.com/urfave/cli from 1.22.1 to 1.22.3 (#6015)
dependabot-preview[bot] Mar 27, 2020
2acc994
build(deps): bump gopkg.in/macaron.v1 from 1.3.4 to 1.3.5 (#6016)
dependabot-preview[bot] Mar 27, 2020
1d85618
build(deps): bump github.com/mattn/go-sqlite3 from 1.11.0 to 1.… (#6017)
dependabot-preview[bot] Mar 27, 2020
0be8db6
github: use Actions for CI (#6022)
unknwon Mar 27, 2020
4c500d8
README: remove unused badge (#6024)
unknwon Mar 27, 2020
932a683
build(deps): bump github.com/stretchr/testify from 1.4.0 to 1.5… (#6019)
dependabot-preview[bot] Mar 27, 2020
d0df6ae
build(deps): bump github.com/editorconfig/editorconfig-core-go/… (#6020)
dependabot-preview[bot] Mar 27, 2020
26cdef1
build(deps): bump xorm.io/builder from 0.3.6 to 0.3.7 (#6021)
dependabot-preview[bot] Mar 27, 2020
8c9e5bf
Revert "build(deps): bump xorm.io/builder from 0.3.6 to 0.3.7" (#6025)
unknwon Mar 27, 2020
250c8b2
web: rename CSRF header (#6027)
unknwon Mar 28, 2020
75e9c78
api: support get releases endpoint (#6026)
Mar 28, 2020
10d7e40
dep: bump github.com/gogs/git-module from 1.0.1 to 1.0.2 (#6030)
unknwon Mar 29, 2020
6e62858
codecov: formalize coverage settings (#6031)
unknwon Mar 29, 2020
7bf87ad
gitutil: refactor the way to mock (#6032)
unknwon Mar 29, 2020
5e520e3
gitutil: simplify mock with `t.Cleanup` (#6033)
unknwon Mar 29, 2020
61277e2
build(deps): bump github.com/go-sql-driver/mysql from 1.4.1 to… (#6037)
dependabot-preview[bot] Mar 29, 2020
762f6a2
build(deps): bump github.com/json-iterator/go from 1.1.7 to 1.1… (#6036)
dependabot-preview[bot] Mar 29, 2020
0f91c26
build(deps): bump github.com/niklasfasching/go-org from 0.1.6 t… (#6043)
dependabot-preview[bot] Mar 29, 2020
3f6c91a
build(deps): bump github.com/sergi/go-diff from 1.0.0 to 1.1.0 (#6042)
dependabot-preview[bot] Mar 29, 2020
d64efbf
build(deps): bump gopkg.in/ini.v1 from 1.54.0 to 1.55.0 (#6039)
dependabot-preview[bot] Mar 29, 2020
8498881
build(deps): bump github.com/go-macaron/binding from 1.0.1 to 1… (#6045)
dependabot-preview[bot] Mar 29, 2020
bee09e2
build(deps): bump github.com/lib/pq from 1.2.0 to 1.3.0 (#6041)
dependabot-preview[bot] Mar 29, 2020
beeaf3a
build(deps): bump github.com/prometheus/client_golang from 1.2.… (#6044)
dependabot-preview[bot] Mar 29, 2020
1a1e421
locale: sync from Crowdin (#6046)
unknwon Mar 29, 2020
c5ca552
template: better diff handling of rename and deleted files (#6048)
unknwon Mar 30, 2020
f6e2d0c
Update CHANGELOG (#6049)
unknwon Mar 30, 2020
9178ec0
build(deps): bump github.com/pkg/errors from 0.8.1 to 0.9.1 (#6047)
dependabot-preview[bot] Mar 31, 2020
4978d14
dep: bump github.com/gogs/git-module from 1.1.0 to 1.1.1 (#6051)
unknwon Mar 31, 2020
6a0f190
build(deps): bump github.com/urfave/cli from 1.22.3 to 1.22.4 (#6055)
dependabot-preview[bot] Apr 2, 2020
3a6cab4
lfs: implement HTTP routes (#6035)
unknwon Apr 4, 2020
e781a84
lfs: run e2e and fix minor issues (#6059)
unknwon Apr 4, 2020
9a9d51b
lfs: support upload retry (#6061)
unknwon Apr 4, 2020
e42af31
db: use gorm function to check `ErrRecordNotFound` (#6060)
unknwon Apr 4, 2020
16b41ce
lfs: only remove file on io error (#6062)
unknwon Apr 4, 2020
bced406
route: no session for routes without UI (#6066)
unknwon Apr 4, 2020
0a996ca
conf: clearer doc comments for mirror config options (#6058)
alpencrossi Apr 6, 2020
9c3f576
build: require Go 1.14 for using `t.Cleanup` (#6069)
unknwon Apr 6, 2020
98e89f7
locale: sync from Crowdin (#6071)
unknwon Apr 6, 2020
9630f71
lfs: add unit test for middleware (#6070)
unknwon Apr 6, 2020
dbdf1ca
repo: delete rows in `lfs_object` table when delete repo (#6072)
unknwon Apr 6, 2020
f8249b7
lfs: add tests to batch endpoint (#6073)
unknwon Apr 6, 2020
6b2f091
db: handle JSON conversion for `LoginSource` (#6075)
unknwon Apr 6, 2020
be731f3
db: include the Team ID in the error message (#6056)
ss23 Apr 6, 2020
a51f1dd
docker: fix the bug of using root account to create `/data/*` directo…
eightpigs Apr 7, 2020
538aa5a
lfs import fixes
mpsonntag Nov 26, 2020
0664e4c
github: update bug report template (#6076)
unknwon Apr 7, 2020
ce19124
docker: bump to Go 1.14 (#6077)
unknwon Apr 7, 2020
b5dda73
route: bypass require signin check for trigger repo tasks (#6079)
unknwon Apr 8, 2020
8ca627f
docker: clean up never used files (#6080)
unknwon Apr 8, 2020
e5bb6d8
repo: disable public access option when using external wiki and issue…
alpencrossi Apr 8, 2020
2528335
lfsutil: add `Storager` interface and local storage (#6083)
unknwon Apr 10, 2020
663bec8
db: add tests for helper functions (#6084)
unknwon Apr 10, 2020
1823a53
Revert "docker: fix the bug of using root account to create `/d… (#6085)
unknwon Apr 10, 2020
fc1f3a7
access_token: migrate to GORM and add tests (#6086)
unknwon Apr 10, 2020
68f37e8
db: add tests for LFS (#6087)
unknwon Apr 10, 2020
3035394
db: add tests for permissions (#6088)
unknwon Apr 10, 2020
755d455
login_source: migrate to GORM and add tests (#6090)
unknwon Apr 11, 2020
c7fa7ab
db: only use `AutoMigrate` to create new tables (#6092)
unknwon Apr 11, 2020
fe6544c
ssh: ignore malformed "env" commands (#6094)
unknwon Apr 12, 2020
69572ed
ssh: improve env command processing (#6095)
gancuinoodle Apr 12, 2020
d047732
github: update bug report template (#6097)
unknwon Apr 13, 2020
c06269b
db: add tests for two factors (#6099)
unknwon Apr 14, 2020
e60a968
db: use GORM bulk insert helper (#6100)
unknwon Apr 14, 2020
6abcefe
db: add tests for `loginSourceFiles` (#6102)
unknwon Apr 14, 2020
7fc1262
api: add admin endpoint to get team members (#6101)
ruianderson Apr 14, 2020
cc4b83d
Update CHANGELOG (#6103)
unknwon Apr 14, 2020
72637c1
docs: fix Go version (#6105)
unknwon Apr 15, 2020
3a5e244
docker: fix the bug of using root to create /data/ directory (#6106)
eightpigs Apr 15, 2020
da58cd6
docker: fix mkdir subdir in /data failed when no mount volume (#6107)
eightpigs Apr 15, 2020
ddb4fdb
db: add tests for repos (#6112)
unknwon Apr 17, 2020
45044e1
db: add tests for users (#6116)
unknwon Apr 18, 2020
09299a1
public: remove unused github.min.css (#6119)
unknwon Apr 18, 2020
5d1b11a
conf: fallback time layout to RFC 3339 when misconfigured (#6120)
kousikmitra Apr 18, 2020
5dcbe69
test: remove the use of goconvey (#6123)
unknwon Apr 18, 2020
82cbb47
db: remove `db.User.LoginType` field (#6122)
kousikmitra Apr 18, 2020
0814a9e
Update CHANGELOG.md
unknwon Apr 19, 2020
9483030
lfs: show configs in admin ui (#6128)
unknwon Apr 21, 2020
7785c1e
build(deps): bump github.com/editorconfig/editorconfig-core-go/v2 fro…
dependabot-preview[bot] Apr 25, 2020
af7dd7e
build(deps): bump gopkg.in/macaron.v1 from 1.3.5 to 1.3.6 (#6143)
dependabot-preview[bot] May 2, 2020
2ccae5e
build(deps): bump github.com/prometheus/client_golang from 1.5.1 to 1…
dependabot-preview[bot] May 2, 2020
3b36d0c
Add security policy
unknwon May 2, 2020
8713bac
db: use GORM to backup and restore non-legacy tables (#6142)
unknwon May 4, 2020
27fe714
all: use semver to compare versions (#6147)
unknwon May 4, 2020
7e71580
build(deps): bump gopkg.in/macaron.v1 from 1.3.6 to 1.3.8 (#6153)
dependabot-preview[bot] May 9, 2020
7026947
locale: sync from Crowdin (#6156)
unknwon May 10, 2020
e3f6a74
lfs: add user and admin docs (#6158)
unknwon May 10, 2020
1760f65
docker: add scheduled backups with retention policy (#6140)
xZero707 May 11, 2020
ac59434
build(deps): bump gopkg.in/ini.v1 from 1.55.0 to 1.56.0 (#6166)
dependabot-preview[bot] May 16, 2020
49d08dc
docker: fix broken link in README
unknwon May 20, 2020
45cbf6e
lsif: don't upload indexes for forks (#6170)
gbrik May 21, 2020
592a4f3
lsif: upload data to dogfood instance (#6171)
unknwon May 22, 2020
be8713f
locale: sync from Crowdin (#6174)
unknwon May 24, 2020
c9b4286
build(deps): bump github.com/stretchr/testify from 1.5.1 to 1.6.0 (#6…
dependabot-preview[bot] May 29, 2020
4228e8a
locale: sync from Crowdin (#6191)
unknwon Jun 8, 2020
94db16d
README: remove OpenShift link (#6194)
unknwon Jun 11, 2020
7bbfc86
Add CodeQL security scanning (#6188)
jhutchings1 Jun 11, 2020
6742931
Update Dockerfiles for ARM to use alpine golang (#6183)
Nakrez Jun 11, 2020
07d7b1e
build(deps): bump github.com/stretchr/testify from 1.6.0 to 1.6.1 (#6…
dependabot-preview[bot] Jun 13, 2020
437c875
build(deps): bump gopkg.in/macaron.v1 from 1.3.8 to 1.3.9 (#6200)
dependabot-preview[bot] Jun 13, 2020
14dd908
build(deps): bump github.com/json-iterator/go from 1.1.9 to 1.1.10 (#…
dependabot-preview[bot] Jun 13, 2020
fc9b0f7
lsif: fix upload to private instance (#6216)
unknwon Jun 29, 2020
ad458f0
workflow: add shellcheck as a linter (#6202)
dre2004 Jul 17, 2020
066f891
README: update VPS sponsor
unknwon Aug 16, 2020
e2e2b26
db: fix update team panic (#6253)
unknwon Aug 16, 2020
e140578
organization: limit showing at most 12 members in profile page (#6254)
unknwon Aug 17, 2020
482eea5
build(deps): bump github.com/microcosm-cc/bluemonday from 1.0.2 to 1.…
dependabot-preview[bot] Aug 17, 2020
f6ac2e4
build(deps): bump golang.org/x/text from 0.3.2 to 0.3.3 (#6207)
dependabot-preview[bot] Aug 17, 2020
932fa9b
docker: fix gosu link in Dockerfile.rpi (#6203)
InsanusMokrassar Aug 17, 2020
50572df
osutil: use system API to get the username when env vars are empty (#…
bibo38 Aug 19, 2020
debef3d
osutil: update docstring and tests (#6255)
unknwon Aug 19, 2020
f797933
deps: update git-module to v.1.1.2 (#6256)
manfer Aug 21, 2020
4985fc7
CHANGELOG: add entry for gogs/git-module#59 (#6257)
unknwon Aug 21, 2020
498ea55
conf: fix some typos in comments (app.ini) (#6237)
DRSDavidSoft Aug 21, 2020
b4f5cdf
conf: make generate for #6237 (#6260)
unknwon Aug 21, 2020
5d91f3b
repo: users have access to base repository can also view forks (#6261)
unknwon Aug 22, 2020
7e671ff
locale: sync from Crowdin (#6263)
unknwon Aug 22, 2020
b047453
CHANGELOG: cut 0.12.0 and 0.13.0+dev (#6264)
unknwon Aug 22, 2020
29cef04
release: remove dev version notion
unknwon Aug 22, 2020
362880b
assets: make generate (#6265)
unknwon Aug 22, 2020
e129d5d
issue: fix timestamp updating (#6210)
Kosadchiy Aug 24, 2020
d6e7da4
db: fix wrong column type of `login_source` (#6283)
unknwon Aug 27, 2020
f8d0b84
release: update version to 0.12.1
unknwon Aug 27, 2020
af9c626
web: correctly serving go-get pages for subdirs (#6318)
unknwon Sep 9, 2020
8374717
gitutil: infer submodule with baseURL when it is a relative path (#6337)
unknwon Sep 18, 2020
2cca223
dep: update github.com/unknwon/cae to v1.0.2 (#6342)
unknwon Sep 21, 2020
cab45f0
action: fix issue reference regexp and error handling (#6352)
unknwon Sep 26, 2020
746447f
release: update version to 0.12.2
unknwon Sep 26, 2020
0e5b866
ci: update Go workflow from main
unknwon Sep 26, 2020
9521732
cmd/serv: use different log files for ORMs in hook mode (#6361)
unknwon Sep 29, 2020
0677f9b
markup: render SHA links without branch prefix (#6350)
laojianzi Sep 29, 2020
53c14f5
lfs: ask client to always send the same value for the HTTP header (#6…
unknwon Oct 4, 2020
91c09d1
release: update version to 0.12.3
unknwon Oct 7, 2020
16f5c71
context: add X-Frame-Options header (#6411)
matheusmosca Nov 11, 2020
b66a68f
repo: disallow urlencoded new lines in git protocol paths (#6420)
stypr Nov 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
action: fix issue reference regexp and error handling (#6352)
unknwon authored and mpsonntag committed Dec 2, 2020
commit cab45f05feb481d9ec12b9c725920ceeca3a7a95
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ All notable changes to Gogs are documented in this file.
- _Regression:_ Pages are correctly rendered when requesting `?go-get=1` for subdirectories. [#6314](https://github.com/gogs/gogs/issues/6314)
- _Regression:_ Submodule with a relative path is linked correctly. [#6319](https://github.com/gogs/gogs/issues/6319)
- Backup can be processed when `--target` is specified on Windows. [#6339](https://github.com/gogs/gogs/issues/6339)
- Commit message contains keywords look like an issue reference no longer fails the push entirely. [#6289](https://github.com/gogs/gogs/issues/6289)

### Removed

12 changes: 6 additions & 6 deletions internal/db/action.go
Original file line number Diff line number Diff line change
@@ -57,9 +57,9 @@ var (
IssueCloseKeywords = []string{"close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"}
IssueReopenKeywords = []string{"reopen", "reopens", "reopened"}

IssueCloseKeywordsPat = lazyregexp.New(assembleKeywordsPattern(IssueCloseKeywords))
IssueReopenKeywordsPat = lazyregexp.New(assembleKeywordsPattern(IssueReopenKeywords))
IssueReferenceKeywordsPat = lazyregexp.New(`(?i)(?:)(^| )\S+`)
IssueCloseKeywordsPat = lazyregexp.New(assembleKeywordsPattern(IssueCloseKeywords))
IssueReopenKeywordsPat = lazyregexp.New(assembleKeywordsPattern(IssueReopenKeywords))
issueReferencePattern = lazyregexp.New(`(?i)(?:)(^| )\S*#\d+`)
)

func assembleKeywordsPattern(words []string) string {
@@ -321,8 +321,8 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit) err
c := commits[i]

refMarked := make(map[int64]bool)
for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) {
ref = ref[strings.IndexByte(ref, byte(' '))+1:]
for _, ref := range issueReferencePattern.FindAllString(c.Message, -1) {
ref = strings.TrimSpace(ref)
ref = strings.TrimRightFunc(ref, issueIndexTrimRight)

if len(ref) == 0 {
@@ -455,7 +455,7 @@ type CommitRepoActionOptions struct {
Commits *PushCommits
}

// CommitRepoAction adds new commit actio to the repository, and prepare corresponding webhooks.
// CommitRepoAction adds new commit action to the repository, and prepare corresponding webhooks.
func CommitRepoAction(opts CommitRepoActionOptions) error {
pusher, err := GetUserByName(opts.PusherName)
if err != nil {
41 changes: 41 additions & 0 deletions internal/db/action_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2020 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package db

import (
"testing"

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

func Test_issueReferencePattern(t *testing.T) {
tests := []struct {
name string
message string
expStrings []string
}{
{
name: "no match",
message: "Hello world!",
expStrings: nil,
},
{
name: "contains issue numbers",
message: "#123 is fixed, and #456 is WIP",
expStrings: []string{"#123", " #456"},
},
{
name: "contains full issue references",
message: "#123 is fixed, and user/repo#456 is WIP",
expStrings: []string{"#123", " user/repo#456"},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
strs := issueReferencePattern.FindAllString(test.message, -1)
assert.Equal(t, test.expStrings, strs)
})
}
}
20 changes: 0 additions & 20 deletions internal/db/errors/issue.go

This file was deleted.

5 changes: 2 additions & 3 deletions internal/db/issue.go
Original file line number Diff line number Diff line change
@@ -817,12 +817,11 @@ func (ErrIssueNotExist) NotFound() bool {
return true
}

// GetIssueByRef returns an Issue specified by a GFM reference.
// See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
// GetIssueByRef returns an Issue specified by a GFM reference, e.g. owner/repo#123.
func GetIssueByRef(ref string) (*Issue, error) {
n := strings.IndexByte(ref, byte('#'))
if n == -1 {
return nil, errors.InvalidIssueReference{Ref: ref}
return nil, ErrIssueNotExist{args: map[string]interface{}{"ref": ref}}
}

index := com.StrTo(ref[n+1:]).MustInt64()