diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-04-19 21:40:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-19 21:40:42 +0800 |
commit | e422342eebc18034ef586ec58f1e2fff0340091d (patch) | |
tree | 307264b46c1683915429083d54e9634ee4f2fc4d /modules/setting/setting.go | |
parent | 01214c8ada993bf5f54a4149979d140443d69410 (diff) | |
download | gitea-e422342eebc18034ef586ec58f1e2fff0340091d.tar.gz gitea-e422342eebc18034ef586ec58f1e2fff0340091d.zip |
Allow adding new files to an empty repo (#24164)

Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r-- | modules/setting/setting.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 4d7a7caab8..e1a57615a8 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -27,7 +27,7 @@ import ( var ( // AppVer is the version of the current build of Gitea. It is set in main.go from main.Version. AppVer string - // AppBuiltWith represents a human readable version go runtime build version and build tags. (See main.go formatBuiltWith().) + // AppBuiltWith represents a human-readable version go runtime build version and build tags. (See main.go formatBuiltWith().) AppBuiltWith string // AppStartTime store time gitea has started AppStartTime time.Time @@ -40,7 +40,8 @@ var ( // AppWorkPath is used as the base path for several other paths. AppWorkPath string - // Global setting objects + // Other global setting objects + CfgProvider ConfigProvider CustomPath string // Custom directory path CustomConf string @@ -48,6 +49,10 @@ var ( RunUser string IsProd bool IsWindows bool + + // IsInTesting indicates whether the testing is running. A lot of unreliable code causes a lot of nonsense error logs during testing + // TODO: this is only a temporary solution, we should make the test code more reliable + IsInTesting = false ) func getAppPath() (string, error) { @@ -108,8 +113,12 @@ func getWorkPath(appPath string) string { func init() { IsWindows = runtime.GOOS == "windows" + if AppVer == "" { + AppVer = "dev" + } + // We can rely on log.CanColorStdout being set properly because modules/log/console_windows.go comes before modules/setting/setting.go lexicographically - // By default set this logger at Info - we'll change it later but we need to start with something. + // By default set this logger at Info - we'll change it later, but we need to start with something. log.NewLogger(0, "console", "console", fmt.Sprintf(`{"level": "info", "colorize": %t, "stacktraceLevel": "none"}`, log.CanColorStdout)) var err error |