Skip to content

Commit a2deec3

Browse files
committed
Merge branch 'master' into search_type
2 parents 2bd9cb2 + 7a7f560 commit a2deec3

File tree

193 files changed

+7560
-8691
lines changed

Some content is hidden

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

193 files changed

+7560
-8691
lines changed

build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ package main
1111

1212
import (
1313
// for lint
14-
_ "github.com/BurntSushi/toml"
1514
_ "github.com/mgechev/dots"
1615
_ "github.com/mgechev/revive/formatter"
1716
_ "github.com/mgechev/revive/lint"
1817
_ "github.com/mgechev/revive/rule"
1918
_ "github.com/mitchellh/go-homedir"
19+
_ "github.com/pelletier/go-toml"
2020

2121
// for embed
2222
_ "github.com/shurcooL/vfsgen"

build/lint.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import (
1515
"path/filepath"
1616
"strings"
1717

18-
"github.com/BurntSushi/toml"
1918
"github.com/mgechev/dots"
2019
"github.com/mgechev/revive/formatter"
2120
"github.com/mgechev/revive/lint"
2221
"github.com/mgechev/revive/rule"
2322
"github.com/mitchellh/go-homedir"
23+
"github.com/pelletier/go-toml"
2424
)
2525

2626
func fail(err string) {
@@ -133,7 +133,7 @@ func parseConfig(path string) *lint.Config {
133133
if err != nil {
134134
fail("cannot read the config file")
135135
}
136-
_, err = toml.Decode(string(file), config)
136+
err = toml.Unmarshal(file, config)
137137
if err != nil {
138138
fail("cannot parse the config file: " + err.Error())
139139
}

custom/conf/app.example.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ PREFIX_ARCHIVE_FILES = true
6464
DISABLE_MIRRORS = false
6565
; The default branch name of new repositories
6666
DEFAULT_BRANCH=master
67+
; Allow adoption of unadopted repositories
68+
ALLOW_ADOPTION_OF_UNADOPTED_REPOSITORIES=false
69+
; Allow deletion of unadopted repositories
70+
ALLOW_DELETION_OF_UNADOPTED_REPOSITORIES=false
6771

6872
[repository.editor]
6973
; List of file extensions for which lines should be wrapped in the Monaco editor

go.mod

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ require (
1616
gitea.com/macaron/macaron v1.5.0
1717
gitea.com/macaron/session v0.0.0-20200902202411-e3a87877db6e
1818
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7
19-
github.com/BurntSushi/toml v0.3.1
2019
github.com/PuerkitoBio/goquery v1.5.1
2120
github.com/alecthomas/chroma v0.8.0
2221
github.com/blevesearch/bleve v1.0.10
@@ -63,10 +62,12 @@ require (
6362
github.com/lib/pq v1.8.1-0.20200908161135-083382b7e6fc
6463
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96
6564
github.com/markbates/goth v1.61.2
65+
github.com/mattn/go-colorable v0.1.7 // indirect
6666
github.com/mattn/go-isatty v0.0.12
67+
github.com/mattn/go-runewidth v0.0.9 // indirect
6768
github.com/mattn/go-sqlite3 v1.14.0
6869
github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81
69-
github.com/mgechev/revive v1.0.2
70+
github.com/mgechev/revive v1.0.3-0.20200921231451-246eac737dc7
7071
github.com/mholt/archiver/v3 v3.3.0
7172
github.com/microcosm-cc/bluemonday v1.0.3-0.20191119130333-0a75d7616912
7273
github.com/minio/minio-go/v7 v7.0.4
@@ -76,6 +77,7 @@ require (
7677
github.com/niklasfasching/go-org v1.3.2
7778
github.com/oliamb/cutter v0.2.2
7879
github.com/olivere/elastic/v7 v7.0.9
80+
github.com/pelletier/go-toml v1.8.1
7981
github.com/pkg/errors v0.9.1
8082
github.com/pquerna/otp v1.2.0
8183
github.com/prometheus/client_golang v1.1.0
@@ -102,10 +104,10 @@ require (
102104
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
103105
golang.org/x/net v0.0.0-20200904194848-62affa334b73
104106
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
105-
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae
107+
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff
106108
golang.org/x/text v0.3.3
107109
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
108-
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d
110+
golang.org/x/tools v0.0.0-20200921210052-fa0125251cc4
109111
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
110112
gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect
111113
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df

go.sum

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9
265265
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
266266
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
267267
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
268-
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
269268
github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=
270269
github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
271270
github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=
@@ -647,6 +646,8 @@ github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaa
647646
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
648647
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
649648
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
649+
github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw=
650+
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
650651
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
651652
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
652653
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@@ -659,6 +660,8 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX
659660
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
660661
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
661662
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
663+
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
664+
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
662665
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
663666
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
664667
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
@@ -667,8 +670,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0j
667670
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
668671
github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81 h1:QASJXOGm2RZ5Ardbc86qNFvby9AqkLDibfChMtAg5QM=
669672
github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg=
670-
github.com/mgechev/revive v1.0.2 h1:v0NxxQ7fSFz/u1NQydPo6EGdq7va0J1BtsZmae6kzUg=
671-
github.com/mgechev/revive v1.0.2/go.mod h1:rb0dQy1LVAxW9SWy5R3LPUjevzUbUS316U5MFySA2lo=
673+
github.com/mgechev/revive v1.0.3-0.20200921231451-246eac737dc7 h1:ydVkpU/M4/c45yT3e5lzMeguKJm9GxGgsawx4/XlwK0=
674+
github.com/mgechev/revive v1.0.3-0.20200921231451-246eac737dc7/go.mod h1:no/hfevHbndpXR5CaJahkYCfM/FFpmM/dSOwFGU7Z1o=
672675
github.com/mholt/archiver/v3 v3.3.0 h1:vWjhY8SQp5yzM9P6OJ/eZEkmi3UAbRrxCq48MxjAzig=
673676
github.com/mholt/archiver/v3 v3.3.0/go.mod h1:YnQtqsp+94Rwd0D/rk5cnLrxusUBUXg+08Ebtr1Mqao=
674677
github.com/microcosm-cc/bluemonday v1.0.3-0.20191119130333-0a75d7616912 h1:hJde9rA24hlTcAYSwJoXpDUyGtfKQ/jsofw+WaDqGrI=
@@ -739,6 +742,8 @@ github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfS
739742
github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo=
740743
github.com/pelletier/go-toml v1.8.0 h1:Keo9qb7iRJs2voHvunFtuuYFsbWeOBh8/P9v/kVMFtw=
741744
github.com/pelletier/go-toml v1.8.0/go.mod h1:D6yutnOGMveHEPV7VQOuvI/gXY61bv+9bAOTRnLElKs=
745+
github.com/pelletier/go-toml v1.8.1 h1:1Nf83orprkJyknT6h7zbuEGUEjcyVlCxSUGTENmNCRM=
746+
github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrapLU/GW4pbc=
742747
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
743748
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
744749
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
@@ -981,7 +986,6 @@ golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU
981986
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
982987
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
983988
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
984-
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
985989
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
986990
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
987991
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -1017,6 +1021,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/
10171021
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
10181022
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
10191023
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
1024+
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
10201025
golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
10211026
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
10221027
golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -1075,6 +1080,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
10751080
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10761081
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
10771082
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1083+
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff h1:1CPUrky56AcgSpxz/KfgzQWzfG09u5YOL8MvPYBlrL8=
1084+
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
10781085
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
10791086
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
10801087
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -1114,17 +1121,18 @@ golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtn
11141121
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
11151122
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
11161123
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
1117-
golang.org/x/tools v0.0.0-20200225230052-807dcd883420/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
11181124
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
11191125
golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
1120-
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d h1:W07d4xkoAUSNOkOzdzXCdFGxT7o2rW4q8M34tB2i//k=
1121-
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
1126+
golang.org/x/tools v0.0.0-20200921210052-fa0125251cc4 h1:v8Jgq9X6Es9K9otVr9jxENEJigepKMZgA9OmrIZDtFA=
1127+
golang.org/x/tools v0.0.0-20200921210052-fa0125251cc4/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
11221128
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
11231129
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
11241130
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
11251131
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
11261132
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
11271133
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1134+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
1135+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
11281136
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
11291137
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
11301138
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -1219,7 +1227,6 @@ honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWh
12191227
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
12201228
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
12211229
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
1222-
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
12231230
mvdan.cc/xurls/v2 v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=
12241231
mvdan.cc/xurls/v2 v2.1.0/go.mod h1:5GrSd9rOnKOpZaji1OZLYL/yeAAtGDlo/cFe+8K5n8E=
12251232
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

models/error.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,22 @@ func (err ErrRepoAlreadyExist) Error() string {
743743
return fmt.Sprintf("repository already exists [uname: %s, name: %s]", err.Uname, err.Name)
744744
}
745745

746+
// ErrRepoFilesAlreadyExist represents a "RepoFilesAlreadyExist" kind of error.
747+
type ErrRepoFilesAlreadyExist struct {
748+
Uname string
749+
Name string
750+
}
751+
752+
// IsErrRepoFilesAlreadyExist checks if an error is a ErrRepoAlreadyExist.
753+
func IsErrRepoFilesAlreadyExist(err error) bool {
754+
_, ok := err.(ErrRepoFilesAlreadyExist)
755+
return ok
756+
}
757+
758+
func (err ErrRepoFilesAlreadyExist) Error() string {
759+
return fmt.Sprintf("repository files already exist [uname: %s, name: %s]", err.Uname, err.Name)
760+
}
761+
746762
// ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.
747763
type ErrForkAlreadyExist struct {
748764
Uname string

models/issue.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
12661266
opts.setupSession(sess)
12671267
sortIssuesSession(sess, opts.SortType, opts.PriorityRepoID)
12681268

1269-
issues := make([]*Issue, 0, setting.UI.IssuePagingNum)
1269+
issues := make([]*Issue, 0, opts.ListOptions.PageSize)
12701270
if err := sess.Find(&issues); err != nil {
12711271
return nil, fmt.Errorf("Find: %v", err)
12721272
}
@@ -1279,6 +1279,27 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
12791279
return issues, nil
12801280
}
12811281

1282+
// CountIssues number return of issues by given conditions.
1283+
func CountIssues(opts *IssuesOptions) (int64, error) {
1284+
sess := x.NewSession()
1285+
defer sess.Close()
1286+
1287+
countsSlice := make([]*struct {
1288+
RepoID int64
1289+
Count int64
1290+
}, 0, 1)
1291+
1292+
sess.Select("COUNT(issue.id) AS count").Table("issue")
1293+
opts.setupSession(sess)
1294+
if err := sess.Find(&countsSlice); err != nil {
1295+
return 0, fmt.Errorf("Find: %v", err)
1296+
}
1297+
if len(countsSlice) < 1 {
1298+
return 0, fmt.Errorf("there is less than one result sql record")
1299+
}
1300+
return countsSlice[0].Count, nil
1301+
}
1302+
12821303
// GetParticipantsIDsByIssueID returns the IDs of all users who participated in comments of an issue,
12831304
// but skips joining with `user` for performance reasons.
12841305
// User permissions must be verified elsewhere if required.

models/repo.go

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ func (repo *Repository) IsBeingCreated() bool {
278278
func (repo *Repository) AfterLoad() {
279279
// FIXME: use models migration to solve all at once.
280280
if len(repo.DefaultBranch) == 0 {
281-
repo.DefaultBranch = "master"
281+
repo.DefaultBranch = setting.Repository.DefaultBranch
282282
}
283283

284284
repo.NumOpenIssues = repo.NumIssues - repo.NumClosedIssues
@@ -1048,7 +1048,7 @@ func (repo *Repository) CloneLink() (cl *CloneLink) {
10481048
}
10491049

10501050
// CheckCreateRepository check if could created a repository
1051-
func CheckCreateRepository(doer, u *User, name string) error {
1051+
func CheckCreateRepository(doer, u *User, name string, overwriteOrAdopt bool) error {
10521052
if !doer.CanCreateRepo() {
10531053
return ErrReachLimitOfRepo{u.MaxRepoCreation}
10541054
}
@@ -1063,6 +1063,10 @@ func CheckCreateRepository(doer, u *User, name string) error {
10631063
} else if has {
10641064
return ErrRepoAlreadyExist{u.Name, name}
10651065
}
1066+
1067+
if !overwriteOrAdopt && com.IsExist(RepoPath(u.Name, name)) {
1068+
return ErrRepoFilesAlreadyExist{u.Name, name}
1069+
}
10661070
return nil
10671071
}
10681072

@@ -1116,11 +1120,15 @@ var (
11161120

11171121
// IsUsableRepoName returns true when repository is usable
11181122
func IsUsableRepoName(name string) error {
1123+
if alphaDashDotPattern.MatchString(name) {
1124+
// Note: usually this error is normally caught up earlier in the UI
1125+
return ErrNameCharsNotAllowed{Name: name}
1126+
}
11191127
return isUsableName(reservedRepoNames, reservedRepoPatterns, name)
11201128
}
11211129

11221130
// CreateRepository creates a repository for the user/organization.
1123-
func CreateRepository(ctx DBContext, doer, u *User, repo *Repository) (err error) {
1131+
func CreateRepository(ctx DBContext, doer, u *User, repo *Repository, overwriteOrAdopt bool) (err error) {
11241132
if err = IsUsableRepoName(repo.Name); err != nil {
11251133
return err
11261134
}
@@ -1132,6 +1140,15 @@ func CreateRepository(ctx DBContext, doer, u *User, repo *Repository) (err error
11321140
return ErrRepoAlreadyExist{u.Name, repo.Name}
11331141
}
11341142

1143+
repoPath := RepoPath(u.Name, repo.Name)
1144+
if !overwriteOrAdopt && com.IsExist(repoPath) {
1145+
log.Error("Files already exist in %s and we are not going to adopt or delete.", repoPath)
1146+
return ErrRepoFilesAlreadyExist{
1147+
Uname: u.Name,
1148+
Name: repo.Name,
1149+
}
1150+
}
1151+
11351152
if _, err = ctx.e.Insert(repo); err != nil {
11361153
return err
11371154
}
@@ -1856,6 +1873,10 @@ func GetUserRepositories(opts *SearchRepoOptions) ([]*Repository, int64, error)
18561873
cond = cond.And(builder.Eq{"is_private": false})
18571874
}
18581875

1876+
if opts.LowerNames != nil && len(opts.LowerNames) > 0 {
1877+
cond = cond.And(builder.In("lower_name", opts.LowerNames))
1878+
}
1879+
18591880
sess := x.NewSession()
18601881
defer sess.Close()
18611882

models/repo_list.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ type SearchRepoOptions struct {
175175
// True -> include just has milestones
176176
// False -> include just has no milestone
177177
HasMilestones util.OptionalBool
178+
// LowerNames represents valid lower names to restrict to
179+
LowerNames []string
178180
}
179181

180182
//SearchOrderBy is used to sort the result

models/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ func (u *User) GetOrganizationCount() (int64, error) {
646646
}
647647

648648
// GetRepositories returns repositories that user owns, including private repositories.
649-
func (u *User) GetRepositories(listOpts ListOptions) (err error) {
650-
u.Repos, _, err = GetUserRepositories(&SearchRepoOptions{Actor: u, Private: true, ListOptions: listOpts})
649+
func (u *User) GetRepositories(listOpts ListOptions, names ...string) (err error) {
650+
u.Repos, _, err = GetUserRepositories(&SearchRepoOptions{Actor: u, Private: true, ListOptions: listOpts, LowerNames: names})
651651
return err
652652
}
653653

modules/auth/repo_form.go

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

1212
"code.gitea.io/gitea/models"
1313
"code.gitea.io/gitea/modules/setting"
14+
"code.gitea.io/gitea/modules/structs"
1415
"code.gitea.io/gitea/routers/utils"
1516

1617
"gitea.com/macaron/binding"
@@ -57,11 +58,11 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
5758
// this is used to interact with web ui
5859
type MigrateRepoForm struct {
5960
// required: true
60-
CloneAddr string `json:"clone_addr" binding:"Required"`
61-
Service int `json:"service"`
62-
AuthUsername string `json:"auth_username"`
63-
AuthPassword string `json:"auth_password"`
64-
AuthToken string `json:"auth_token"`
61+
CloneAddr string `json:"clone_addr" binding:"Required"`
62+
Service structs.GitServiceType `json:"service"`
63+
AuthUsername string `json:"auth_username"`
64+
AuthPassword string `json:"auth_password"`
65+
AuthToken string `json:"auth_token"`
6566
// required: true
6667
UID int64 `json:"uid" binding:"Required"`
6768
// required: true

modules/git/repo_branch.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ func (repo *Repository) SetDefaultBranch(name string) error {
7474
return err
7575
}
7676

77+
// GetDefaultBranch gets default branch of repository.
78+
func (repo *Repository) GetDefaultBranch() (string, error) {
79+
return NewCommand("symbolic-ref", "HEAD").RunInDir(repo.Path)
80+
}
81+
7782
// GetBranches returns all branches of the repository.
7883
func (repo *Repository) GetBranches() ([]string, error) {
7984
var branchNames []string

0 commit comments

Comments
 (0)