Skip to content

Commit f2c7d32

Browse files
committed
Merge branch 'main' into lunny/project_workflow
2 parents 9d0a599 + fa9191b commit f2c7d32

File tree

532 files changed

+9553
-7176
lines changed

Some content is hidden

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

532 files changed

+9553
-7176
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ module.exports = {
674674
'no-this-before-super': [2],
675675
'no-throw-literal': [2],
676676
'no-undef-init': [2],
677-
'no-undef': [0],
677+
'no-undef': [2], // it is still needed by eslint & IDE to prompt undefined names in real time
678678
'no-undefined': [0],
679679
'no-underscore-dangle': [0],
680680
'no-unexpected-multiline': [2],

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ _test
99

1010
# IntelliJ
1111
.idea
12+
13+
# IntelliJ Gateway
14+
.uuid
15+
1216
# Goland's output filename can not be set manually
1317
/go_build_*
1418
/gitea_*

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Gary Kim <[email protected]> (@gary-kim)
3131
Guillermo Prandi <[email protected]> (@guillep2k)
3232
Mura Li <[email protected]> (@typeless)
3333
6543 <[email protected]> (@6543)
34-
jaqra <[email protected]> (@jaqra)
3534
David Svantesson <[email protected]> (@davidsvantesson)
3635
a1012112796 <[email protected]> (@a1012112796)
3736
Karl Heinz Marbaise <[email protected]> (@khmarbaise)
@@ -63,3 +62,4 @@ Yu Liu <[email protected]> (@HEREYUA)
6362
Kemal Zebari <[email protected]> (@kemzeb)
6463
Rowan Bohde <[email protected]> (@bohde)
6564
hiifong <[email protected]> (@hiifong)
65+
metiftikci <[email protected]> (@metiftikci)

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,22 +806,22 @@ $(DIST_DIRS):
806806

807807
.PHONY: release-windows
808808
release-windows: | $(DIST_DIRS)
809-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
809+
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
810810
ifeq (,$(findstring gogit,$(TAGS)))
811-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
811+
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
812812
endif
813813

814814
.PHONY: release-linux
815815
release-linux: | $(DIST_DIRS)
816-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
816+
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w -linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
817817

818818
.PHONY: release-darwin
819819
release-darwin: | $(DIST_DIRS)
820-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
820+
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
821821

822822
.PHONY: release-freebsd
823823
release-freebsd: | $(DIST_DIRS)
824-
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
824+
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-s -w $(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
825825

826826
.PHONY: release-copy
827827
release-copy: | $(DIST_DIRS)

assets/go-licenses.json

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

cmd/admin_user_create.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ var microcmdUserCreate = &cli.Command{
6969
}
7070

7171
func runCreateUser(c *cli.Context) error {
72+
// this command highly depends on the many setting options (create org, visibility, etc.), so it must have a full setting load first
73+
// duplicate setting loading should be safe at the moment, but it should be refactored & improved in the future.
74+
setting.LoadSettings()
75+
7276
if err := argsSet(c, "email"); err != nil {
7377
return err
7478
}

cmd/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ func NewMainApp(appVer AppVersion) *cli.App {
165165
app.Commands = append(app.Commands, subCmdWithConfig...)
166166
app.Commands = append(app.Commands, subCmdStandalone...)
167167

168+
setting.InitGiteaEnvVars()
168169
return app
169170
}
170171

cmd/main_test.go

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package cmd
66
import (
77
"fmt"
88
"io"
9-
"os"
109
"path/filepath"
1110
"strings"
1211
"testing"
@@ -113,37 +112,17 @@ func TestCliCmd(t *testing.T) {
113112
_, _ = fmt.Fprint(ctx.App.Writer, makePathOutput(setting.AppWorkPath, setting.CustomPath, setting.CustomConf))
114113
return nil
115114
})
116-
var envBackup []string
117-
for _, s := range os.Environ() {
118-
if strings.HasPrefix(s, "GITEA_") && strings.Contains(s, "=") {
119-
envBackup = append(envBackup, s)
120-
}
121-
}
122-
clearGiteaEnv := func() {
123-
for _, s := range os.Environ() {
124-
if strings.HasPrefix(s, "GITEA_") {
125-
_ = os.Unsetenv(s)
126-
}
127-
}
128-
}
129-
defer func() {
130-
clearGiteaEnv()
131-
for _, s := range envBackup {
132-
k, v, _ := strings.Cut(s, "=")
133-
_ = os.Setenv(k, v)
134-
}
135-
}()
136-
137115
for _, c := range cases {
138-
clearGiteaEnv()
139-
for k, v := range c.env {
140-
_ = os.Setenv(k, v)
141-
}
142-
args := strings.Split(c.cmd, " ") // for test only, "split" is good enough
143-
r, err := runTestApp(app, args...)
144-
assert.NoError(t, err, c.cmd)
145-
assert.NotEmpty(t, c.exp, c.cmd)
146-
assert.Contains(t, r.Stdout, c.exp, c.cmd)
116+
t.Run(c.cmd, func(t *testing.T) {
117+
for k, v := range c.env {
118+
t.Setenv(k, v)
119+
}
120+
args := strings.Split(c.cmd, " ") // for test only, "split" is good enough
121+
r, err := runTestApp(app, args...)
122+
assert.NoError(t, err, c.cmd)
123+
assert.NotEmpty(t, c.exp, c.cmd)
124+
assert.Contains(t, r.Stdout, c.exp, c.cmd)
125+
})
147126
}
148127
}
149128

cmd/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
var CmdMigrate = &cli.Command{
1919
Name: "migrate",
2020
Usage: "Migrate the database",
21-
Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
21+
Description: `This is a command for migrating the database, so that you can run "gitea admin create user" before starting the server.`,
2222
Action: runMigrate,
2323
}
2424

cmd/web.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"path/filepath"
1313
"strconv"
1414
"strings"
15+
"time"
1516

1617
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
1718

@@ -115,6 +116,16 @@ func showWebStartupMessage(msg string) {
115116
log.Info("* CustomPath: %s", setting.CustomPath)
116117
log.Info("* ConfigFile: %s", setting.CustomConf)
117118
log.Info("%s", msg) // show startup message
119+
120+
if setting.CORSConfig.Enabled {
121+
log.Info("CORS Service Enabled")
122+
}
123+
if setting.DefaultUILocation != time.Local {
124+
log.Info("Default UI Location is %v", setting.DefaultUILocation.String())
125+
}
126+
if setting.MailService != nil {
127+
log.Info("Mail Service Enabled: RegisterEmailConfirm=%v, Service.EnableNotifyMail=%v", setting.Service.RegisterEmailConfirm, setting.Service.EnableNotifyMail)
128+
}
118129
}
119130

120131
func serveInstall(ctx *cli.Context) error {

0 commit comments

Comments
 (0)