diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-02-22 15:04:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-22 07:04:30 +0000 |
commit | e9b13732f3d3b5536e43bdfdb5757dbbf484d694 (patch) | |
tree | 6ee4f973b2e9f177931cf343501237a756b6c306 /cmd/serv.go | |
parent | 182b9c193642838dd41bf26f0fe4b2e870770f7e (diff) | |
download | gitea-e9b13732f3d3b5536e43bdfdb5757dbbf484d694.tar.gz gitea-e9b13732f3d3b5536e43bdfdb5757dbbf484d694.zip |
Refactor cmd setup and remove deadcode (#29313)
* use `setup(ctx, c.Bool("debug"))` like all other callers
* `setting.RunMode = "dev"` is a no-op.
* `if _, err := os.Stat(setting.RepoRootPath); err != nil` could be
simplified
Diffstat (limited to 'cmd/serv.go')
-rw-r--r-- | cmd/serv.go | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/cmd/serv.go b/cmd/serv.go index 3cc504beb4..90190a19db 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -63,21 +63,10 @@ func setup(ctx context.Context, debug bool) { setupConsoleLogger(log.FATAL, false, os.Stderr) } setting.MustInstalled() - if debug { - setting.RunMode = "dev" - } - - // Check if setting.RepoRootPath exists. It could be the case that it doesn't exist, this can happen when - // `[repository]` `ROOT` is a relative path and $GITEA_WORK_DIR isn't passed to the SSH connection. if _, err := os.Stat(setting.RepoRootPath); err != nil { - if os.IsNotExist(err) { - _ = fail(ctx, "Incorrect configuration, no repository directory.", "Directory `[repository].ROOT` %q was not found, please check if $GITEA_WORK_DIR is passed to the SSH connection or make `[repository].ROOT` an absolute value.", setting.RepoRootPath) - } else { - _ = fail(ctx, "Incorrect configuration, repository directory is inaccessible", "Directory `[repository].ROOT` %q is inaccessible. err: %v", setting.RepoRootPath, err) - } + _ = fail(ctx, "Unable to access repository path", "Unable to access repository path %q, err: %v", setting.RepoRootPath, err) return } - if err := git.InitSimple(context.Background()); err != nil { _ = fail(ctx, "Failed to init git", "Failed to init git, err: %v", err) } |