Skip to content

Commit a040544

Browse files
committed
Merge branch 'main' into fix-aria-js
2 parents 674d952 + e200c68 commit a040544

Some content is hidden

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

51 files changed

+406
-193
lines changed

.drone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ trigger:
11291129

11301130
steps:
11311131
- name: build-docs
1132-
image: gitea/test_env:linux-1.20-amd64
1132+
image: gitea/test_env:linux-1.20-arm64
11331133
commands:
11341134
- cd docs
11351135
- make trans-copy clean build

assets/go-licenses.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/web.go

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"net"
1010
"net/http"
1111
"os"
12+
"path/filepath"
13+
"strconv"
1214
"strings"
1315

1416
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
@@ -25,6 +27,9 @@ import (
2527
ini "gopkg.in/ini.v1"
2628
)
2729

30+
// PIDFile could be set from build tag
31+
var PIDFile = "/run/gitea.pid"
32+
2833
// CmdWeb represents the available web sub-command.
2934
var CmdWeb = cli.Command{
3035
Name: "web",
@@ -45,7 +50,7 @@ and it takes care of all the other things for you`,
4550
},
4651
cli.StringFlag{
4752
Name: "pid, P",
48-
Value: setting.PIDFile,
53+
Value: PIDFile,
4954
Usage: "Custom pid file path",
5055
},
5156
cli.BoolFlag{
@@ -81,6 +86,22 @@ func runHTTPRedirector() {
8186
}
8287
}
8388

89+
func createPIDFile(pidPath string) {
90+
currentPid := os.Getpid()
91+
if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil {
92+
log.Fatal("Failed to create PID folder: %v", err)
93+
}
94+
95+
file, err := os.Create(pidPath)
96+
if err != nil {
97+
log.Fatal("Failed to create PID file: %v", err)
98+
}
99+
defer file.Close()
100+
if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
101+
log.Fatal("Failed to write PID information: %v", err)
102+
}
103+
}
104+
84105
func runWeb(ctx *cli.Context) error {
85106
if ctx.Bool("verbose") {
86107
_ = log.DelLogger("console")
@@ -107,8 +128,7 @@ func runWeb(ctx *cli.Context) error {
107128

108129
// Set pid file setting
109130
if ctx.IsSet("pid") {
110-
setting.PIDFile = ctx.String("pid")
111-
setting.WritePIDFile = true
131+
createPIDFile(ctx.String("pid"))
112132
}
113133

114134
// Perform pre-initialization

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
THEME := themes/gitea
22
PUBLIC := public
3-
ARCHIVE := https://dl.gitea.io/theme/master.tar.gz
3+
ARCHIVE := https://dl.gitea.com/theme/main.tar.gz
44

55
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.82.0
66

docs/content/doc/installation/from-source.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ using the `LDFLAGS` environment variable for `make`. The appropriate settings ar
159159
- For _`CustomConf`_ you should use `-X \"code.gitea.io/gitea/modules/setting.CustomConf=conf.ini\"`
160160
- For _`AppWorkPath`_ you should use `-X \"code.gitea.io/gitea/modules/setting.AppWorkPath=working-path\"`
161161
- For _`StaticRootPath`_ you should use `-X \"code.gitea.io/gitea/modules/setting.StaticRootPath=static-root-path\"`
162-
- To change the default PID file location use `-X \"code.gitea.io/gitea/modules/setting.PIDFile=/run/gitea.pid\"`
162+
- To change the default PID file location use `-X \"code.gitea.io/gitea/cmd.PIDFile=/run/gitea.pid\"`
163163

164164
Add as many of the strings with their preceding `-X` to the `LDFLAGS` variable and run `make build`
165165
with the appropriate `TAGS` as above.

go.mod

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ require (
7878
github.com/minio/minio-go/v7 v7.0.49
7979
github.com/minio/sha256-simd v1.0.0
8080
github.com/msteinert/pam v1.1.0
81-
github.com/nektos/act v0.0.0
81+
github.com/nektos/act v0.2.43
8282
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
8383
github.com/niklasfasching/go-org v1.6.5
8484
github.com/oliamb/cutter v0.2.2
@@ -106,7 +106,7 @@ require (
106106
golang.org/x/crypto v0.6.0
107107
golang.org/x/net v0.7.0
108108
golang.org/x/oauth2 v0.5.0
109-
golang.org/x/sys v0.5.0
109+
golang.org/x/sys v0.6.0
110110
golang.org/x/text v0.7.0
111111
golang.org/x/tools v0.6.0
112112
google.golang.org/grpc v1.53.0
@@ -174,7 +174,6 @@ require (
174174
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
175175
github.com/go-enry/go-oniguruma v1.2.1 // indirect
176176
github.com/go-git/gcfg v1.5.0 // indirect
177-
github.com/go-ini/ini v1.67.0 // indirect
178177
github.com/go-openapi/analysis v0.21.4 // indirect
179178
github.com/go-openapi/errors v0.20.3 // indirect
180179
github.com/go-openapi/inflect v0.19.0 // indirect
@@ -240,7 +239,7 @@ require (
240239
github.com/prometheus/client_model v0.3.0 // indirect
241240
github.com/prometheus/common v0.37.0 // indirect
242241
github.com/prometheus/procfs v0.8.0 // indirect
243-
github.com/rhysd/actionlint v1.6.22 // indirect
242+
github.com/rhysd/actionlint v1.6.23 // indirect
244243
github.com/rivo/uniseg v0.4.4 // indirect
245244
github.com/robfig/cron v1.2.0 // indirect
246245
github.com/rogpeppe/go-internal v1.9.0 // indirect
@@ -287,7 +286,7 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142
287286

288287
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
289288

290-
replace github.com/nektos/act => gitea.com/gitea/act v0.234.2-0.20230131074955-e46ede1b1744
289+
replace github.com/nektos/act => gitea.com/gitea/act v0.243.1
291290

292291
exclude github.com/gofrs/uuid v3.2.0+incompatible
293292

go.sum

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsi
5252
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
5353
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
5454
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
55-
gitea.com/gitea/act v0.234.2-0.20230131074955-e46ede1b1744 h1:cqzKmGlX0wynSXO04NILpL25eBGwogDrKpkkbwmIpj4=
56-
gitea.com/gitea/act v0.234.2-0.20230131074955-e46ede1b1744/go.mod h1:2C/WbTalu1VPNgbVaZJaZDzlOtAKqkXJhdOClxkMy14=
55+
gitea.com/gitea/act v0.243.1 h1:zIVlhGOLE4SHFPW++u3+5Y/jX5mub3QIhB13oNf6rtA=
56+
gitea.com/gitea/act v0.243.1/go.mod h1:iLHCXqOPUElA2nSyHo4wtxSmvdkym3WU7CkP3AxF39Q=
5757
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681 h1:MMSPgnVULVwV9kEBgvyEUhC9v/uviZ55hPJEMjpbNR4=
5858
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681/go.mod h1:77TZu701zMXWJFvB8gvTbQ92zQ3DQq/H7l5wAEjQRKc=
5959
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=
@@ -385,8 +385,6 @@ github.com/go-git/go-git/v5 v5.5.2/go.mod h1:BE5hUJ5yaV2YMxhmaP4l6RBQ08kMxKSPD4B
385385
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
386386
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
387387
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
388-
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
389-
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
390388
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
391389
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
392390
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
@@ -741,7 +739,7 @@ github.com/jhillyerd/enmime v0.10.1 h1:3VP8gFhK7R948YJBrna5bOgnTXEuPAoICo79kKkBK
741739
github.com/jhillyerd/enmime v0.10.1/go.mod h1:Qpe8EEemJMFAF8+NZoWdpXvK2Yb9dRF0k/z6mkcDHsA=
742740
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
743741
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
744-
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
742+
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
745743
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
746744
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
747745
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
@@ -1046,8 +1044,8 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
10461044
github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
10471045
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
10481046
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
1049-
github.com/rhysd/actionlint v1.6.22 h1:cAEf2PGNwJXhdcTVF2xS/0ORqWS+ueUHwjQYsqFsGSk=
1050-
github.com/rhysd/actionlint v1.6.22/go.mod h1:gIKOdxtV40mBOcD0ZR8EBa8NqjEXToAZioroS3oedMg=
1047+
github.com/rhysd/actionlint v1.6.23 h1:041VOXgZddfvSJa9Il+WT3Iwuo/j0Nmu4bhpAScrds4=
1048+
github.com/rhysd/actionlint v1.6.23/go.mod h1:o5qc1K3I9taGMBhL7mVkpRd64hx3YqI+3t8ewGfYXfE=
10511049
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
10521050
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
10531051
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
@@ -1504,14 +1502,14 @@ golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBc
15041502
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15051503
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15061504
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1507-
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
1508-
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1505+
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
1506+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
15091507
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
15101508
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
15111509
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
15121510
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
15131511
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
1514-
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
1512+
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
15151513
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
15161514
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
15171515
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

models/fixtures/project.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-
22
id: 1
33
title: First project
4+
owner_id: 0
45
repo_id: 1
56
is_closed: false
67
creator_id: 2
@@ -10,6 +11,7 @@
1011
-
1112
id: 2
1213
title: second project
14+
owner_id: 0
1315
repo_id: 3
1416
is_closed: false
1517
creator_id: 3
@@ -19,6 +21,7 @@
1921
-
2022
id: 3
2123
title: project on repo with disabled project
24+
owner_id: 0
2225
repo_id: 4
2326
is_closed: true
2427
creator_id: 5
@@ -29,6 +32,7 @@
2932
id: 4
3033
title: project on user2
3134
owner_id: 2
35+
repo_id: 0
3236
is_closed: false
3337
creator_id: 2
3438
board_type: 1

models/fixtures/repository.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
fork_id: 0
2626
is_template: false
2727
template_id: 0
28-
size: 7028
28+
size: 7320
2929
is_fsck_enabled: true
3030
close_issues_via_commit_in_any_branch: false
3131

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ var migrations = []Migration{
469469
NewMigration("Add NeedApproval to actions tables", v1_20.AddNeedApprovalToActionRun),
470470
// v245 -> v246
471471
NewMigration("Rename Webhook org_id to owner_id", v1_20.RenameWebhookOrgToOwner),
472+
// v246 -> v247
473+
NewMigration("Add missed column owner_id for project table", v1_20.AddNewColumnForProject),
472474
}
473475

474476
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v246.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import (
7+
"xorm.io/xorm"
8+
)
9+
10+
func AddNewColumnForProject(x *xorm.Engine) error {
11+
type Project struct {
12+
OwnerID int64 `xorm:"INDEX"`
13+
}
14+
15+
return x.Sync(new(Project))
16+
}

models/repo/release.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,28 @@ func GetReleasesByRepoID(ctx context.Context, repoID int64, opts FindReleasesOpt
253253
return rels, sess.Find(&rels)
254254
}
255255

256+
// GetTagNamesByRepoID returns a list of release tag names of repository.
257+
func GetTagNamesByRepoID(ctx context.Context, repoID int64) ([]string, error) {
258+
listOptions := db.ListOptions{
259+
ListAll: true,
260+
}
261+
opts := FindReleasesOptions{
262+
ListOptions: listOptions,
263+
IncludeDrafts: true,
264+
IncludeTags: true,
265+
HasSha1: util.OptionalBoolTrue,
266+
}
267+
268+
tags := make([]string, 0)
269+
sess := db.GetEngine(ctx).
270+
Table("release").
271+
Desc("created_unix", "id").
272+
Where(opts.toConds(repoID)).
273+
Cols("tag_name")
274+
275+
return tags, sess.Find(&tags)
276+
}
277+
256278
// CountReleasesByRepoID returns a number of releases matching FindReleaseOptions and RepoID.
257279
func CountReleasesByRepoID(repoID int64, opts FindReleasesOptions) (int64, error) {
258280
return db.GetEngine(db.DefaultContext).Where(opts.toConds(repoID)).Count(new(Release))

models/user/search.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type SearchUserOptions struct {
2222
Keyword string
2323
Type UserType
2424
UID int64
25+
LoginName string // this option should be used only for admin user
26+
SourceID int64 // this option should be used only for admin user
2527
OrderBy db.SearchOrderBy
2628
Visible []structs.VisibleType
2729
Actor *User // The user doing the search
@@ -62,6 +64,13 @@ func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session {
6264
cond = cond.And(builder.Eq{"id": opts.UID})
6365
}
6466

67+
if opts.SourceID > 0 {
68+
cond = cond.And(builder.Eq{"login_source": opts.SourceID})
69+
}
70+
if opts.LoginName != "" {
71+
cond = cond.And(builder.Eq{"login_name": opts.LoginName})
72+
}
73+
6574
if !opts.IsActive.IsNone() {
6675
cond = cond.And(builder.Eq{"is_active": opts.IsActive.IsTrue()})
6776
}

modules/context/repo.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -660,20 +660,9 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) {
660660
return
661661
}
662662

663-
tags, err := ctx.Repo.GitRepo.GetTags(0, 0)
663+
tags, err := repo_model.GetTagNamesByRepoID(ctx, ctx.Repo.Repository.ID)
664664
if err != nil {
665-
if strings.Contains(err.Error(), "fatal: not a git repository ") {
666-
log.Error("Repository %-v has a broken repository on the file system: %s Error: %v", ctx.Repo.Repository, ctx.Repo.Repository.RepoPath(), err)
667-
ctx.Repo.Repository.Status = repo_model.RepositoryBroken
668-
ctx.Repo.Repository.IsEmpty = true
669-
ctx.Data["BranchName"] = ctx.Repo.Repository.DefaultBranch
670-
// Only allow access to base of repo or settings
671-
if !isHomeOrSettings {
672-
ctx.Redirect(ctx.Repo.RepoLink)
673-
}
674-
return
675-
}
676-
ctx.ServerError("GetTags", err)
665+
ctx.ServerError("GetTagNamesByRepoID", err)
677666
return
678667
}
679668
ctx.Data["Tags"] = tags

modules/git/log_name_status.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func LogNameStatusRepo(ctx context.Context, repository, head, treepath string, p
5656
} else if treepath != "" {
5757
files = append(files, treepath)
5858
}
59+
// Use the :(literal) pathspec magic to handle edge cases with files named like ":file.txt" or "*.jpg"
60+
for i, file := range files {
61+
files[i] = ":(literal)" + file
62+
}
5963
cmd.AddDashesAndList(files...)
6064

6165
go func() {

modules/setting/database.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ var (
5454

5555
// LoadDBSetting loads the database settings
5656
func LoadDBSetting() {
57-
sec := CfgProvider.Section("database")
57+
loadDBSetting(CfgProvider)
58+
}
59+
60+
func loadDBSetting(rootCfg ConfigProvider) {
61+
sec := rootCfg.Section("database")
5862
Database.Type = DatabaseType(sec.Key("DB_TYPE").String())
5963
defaultCharset := "utf8"
6064

0 commit comments

Comments
 (0)