Skip to content

Commit 7e6f996

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Use `<nav>` instead of `<div>` in the global navbar (go-gitea#23125) Fix aria.js bugs: incorrect role element problem, mobile focus problem, tippy problem (go-gitea#23450) [skip ci] Updated translations via Crowdin Make time tooltips interactive (go-gitea#23526) Update mini-css-extract-plugin, remove postcss (go-gitea#23520) Fix review comment context menu clipped bug (go-gitea#23523) Add absent repounits to create/edit repo API (go-gitea#23500) Fix tags sort by creation time (descending) on branch/tag dropdowns (go-gitea#23491) Allow both fullname and username search when `DEFAULT_SHOW_FULL_NAME` is true (go-gitea#23463) Handle files starting with colons in WalkGitLog (go-gitea#22935) Change `Close` to either `Close issue` or `Close pull request` (go-gitea#23506) Update act (go-gitea#23512) Move pidfile creation from setting to web cmd package (go-gitea#23285)
2 parents c340f50 + 7692240 commit 7e6f996

Some content is hidden

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

43 files changed

+506
-534
lines changed

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/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/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))

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

modules/setting/setting.go

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"path"
1313
"path/filepath"
1414
"runtime"
15-
"strconv"
1615
"strings"
1716
"time"
1817

@@ -42,15 +41,13 @@ var (
4241
AppWorkPath string
4342

4443
// Global setting objects
45-
CfgProvider ConfigProvider
46-
CustomPath string // Custom directory path
47-
CustomConf string
48-
PIDFile = "/run/gitea.pid"
49-
WritePIDFile bool
50-
RunMode string
51-
RunUser string
52-
IsProd bool
53-
IsWindows bool
44+
CfgProvider ConfigProvider
45+
CustomPath string // Custom directory path
46+
CustomConf string
47+
RunMode string
48+
RunUser string
49+
IsProd bool
50+
IsWindows bool
5451
)
5552

5653
func getAppPath() (string, error) {
@@ -141,22 +138,6 @@ func IsRunUserMatchCurrentUser(runUser string) (string, bool) {
141138
return currentUser, runUser == currentUser
142139
}
143140

144-
func createPIDFile(pidPath string) {
145-
currentPid := os.Getpid()
146-
if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil {
147-
log.Fatal("Failed to create PID folder: %v", err)
148-
}
149-
150-
file, err := os.Create(pidPath)
151-
if err != nil {
152-
log.Fatal("Failed to create PID file: %v", err)
153-
}
154-
defer file.Close()
155-
if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
156-
log.Fatal("Failed to write PID information: %v", err)
157-
}
158-
}
159-
160141
// SetCustomPathAndConf will set CustomPath and CustomConf with reference to the
161142
// GITEA_CUSTOM environment variable and with provided overrides before stepping
162143
// back to the default
@@ -218,17 +199,17 @@ func PrepareAppDataPath() error {
218199

219200
// InitProviderFromExistingFile initializes config provider from an existing config file (app.ini)
220201
func InitProviderFromExistingFile() {
221-
CfgProvider = newFileProviderFromConf(CustomConf, WritePIDFile, false, PIDFile, "")
202+
CfgProvider = newFileProviderFromConf(CustomConf, false, "")
222203
}
223204

224205
// InitProviderAllowEmpty initializes config provider from file, it's also fine that if the config file (app.ini) doesn't exist
225206
func InitProviderAllowEmpty() {
226-
CfgProvider = newFileProviderFromConf(CustomConf, WritePIDFile, true, PIDFile, "")
207+
CfgProvider = newFileProviderFromConf(CustomConf, true, "")
227208
}
228209

229210
// InitProviderAndLoadCommonSettingsForTest initializes config provider and load common setttings for tests
230211
func InitProviderAndLoadCommonSettingsForTest(extraConfigs ...string) {
231-
CfgProvider = newFileProviderFromConf(CustomConf, WritePIDFile, true, PIDFile, strings.Join(extraConfigs, "\n"))
212+
CfgProvider = newFileProviderFromConf(CustomConf, true, strings.Join(extraConfigs, "\n"))
232213
loadCommonSettingsFrom(CfgProvider)
233214
if err := PrepareAppDataPath(); err != nil {
234215
log.Fatal("Can not prepare APP_DATA_PATH: %v", err)
@@ -241,13 +222,9 @@ func InitProviderAndLoadCommonSettingsForTest(extraConfigs ...string) {
241222

242223
// newFileProviderFromConf initializes configuration context.
243224
// NOTE: do not print any log except error.
244-
func newFileProviderFromConf(customConf string, writePIDFile, allowEmpty bool, pidFile, extraConfig string) *ini.File {
225+
func newFileProviderFromConf(customConf string, allowEmpty bool, extraConfig string) *ini.File {
245226
cfg := ini.Empty()
246227

247-
if writePIDFile && len(pidFile) > 0 {
248-
createPIDFile(pidFile)
249-
}
250-
251228
isFile, err := util.IsFile(customConf)
252229
if err != nil {
253230
log.Error("Unable to check if %s is a file. Error: %v", customConf, err)
@@ -380,7 +357,7 @@ func CreateOrAppendToCustomConf(purpose string, callback func(cfg *ini.File)) {
380357

381358
// LoadSettings initializes the settings for normal start up
382359
func LoadSettings() {
383-
LoadDBSetting()
360+
loadDBSetting(CfgProvider)
384361
loadServiceFrom(CfgProvider)
385362
loadOAuth2ClientFrom(CfgProvider)
386363
InitLogs(false)
@@ -401,7 +378,7 @@ func LoadSettings() {
401378

402379
// LoadSettingsForInstall initializes the settings for install
403380
func LoadSettingsForInstall() {
404-
LoadDBSetting()
381+
loadDBSetting(CfgProvider)
405382
loadServiceFrom(CfgProvider)
406383
loadMailerFrom(CfgProvider)
407384
}

modules/structs/repo.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ type Repository struct {
8888
ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"`
8989
HasPullRequests bool `json:"has_pull_requests"`
9090
HasProjects bool `json:"has_projects"`
91+
HasReleases bool `json:"has_releases"`
92+
HasPackages bool `json:"has_packages"`
93+
HasActions bool `json:"has_actions"`
9194
IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"`
9295
AllowMerge bool `json:"allow_merge_commits"`
9396
AllowRebase bool `json:"allow_rebase"`
@@ -168,6 +171,12 @@ type EditRepoOption struct {
168171
HasPullRequests *bool `json:"has_pull_requests,omitempty"`
169172
// either `true` to enable project unit, or `false` to disable them.
170173
HasProjects *bool `json:"has_projects,omitempty"`
174+
// either `true` to enable releases unit, or `false` to disable them.
175+
HasReleases *bool `json:"has_releases,omitempty"`
176+
// either `true` to enable packages unit, or `false` to disable them.
177+
HasPackages *bool `json:"has_packages,omitempty"`
178+
// either `true` to enable actions unit, or `false` to disable them.
179+
HasActions *bool `json:"has_actions,omitempty"`
171180
// either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace.
172181
IgnoreWhitespaceConflicts *bool `json:"ignore_whitespace_conflicts,omitempty"`
173182
// either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits.

modules/templates/helper.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func NewFuncMap() []template.FuncMap {
109109
"CustomEmojis": func() map[string]string {
110110
return setting.UI.CustomEmojisMap
111111
},
112+
"IsShowFullName": func() bool {
113+
return setting.UI.DefaultShowFullName
114+
},
112115
"Safe": Safe,
113116
"SafeJS": SafeJS,
114117
"JSEscape": JSEscape,

0 commit comments

Comments
 (0)