diff options
author | Zettat123 <zettat123@gmail.com> | 2023-03-23 20:30:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 20:30:28 +0800 |
commit | df411819ebe4d3e6852997ce41fadf837d5d4ea0 (patch) | |
tree | 453eec26760e73e16db2c6f7564a59f77b5d9154 /cmd | |
parent | 9be90a58754061171bbd5025d85d2b891364efd3 (diff) | |
download | gitea-df411819ebe4d3e6852997ce41fadf837d5d4ea0.tar.gz gitea-df411819ebe4d3e6852997ce41fadf837d5d4ea0.zip |
Check LFS/Packages settings in dump and doctor command (#23631)
Close #23622
As described in the issue, disabling the LFS/Package settings will cause
errors when running `gitea dump` or `gitea doctor`. We need to check the
settings and the related operations should be skipped if the settings
are disabled.
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/dump.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/dump.go b/cmd/dump.go index 00d279b991..19589caa75 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -250,6 +250,8 @@ func runDump(ctx *cli.Context) error { if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") { log.Info("Skip dumping LFS data") + } else if !setting.LFS.StartServer { + log.Info("LFS isn't enabled. Skip dumping LFS data") } else if err := storage.LFS.IterateObjects("", func(objPath string, object storage.Object) error { info, err := object.Stat() if err != nil { @@ -364,6 +366,8 @@ func runDump(ctx *cli.Context) error { if ctx.IsSet("skip-package-data") && ctx.Bool("skip-package-data") { log.Info("Skip dumping package data") + } else if !setting.Packages.Enabled { + log.Info("Packages isn't enabled. Skip dumping package data") } else if err := storage.Packages.IterateObjects("", func(objPath string, object storage.Object) error { info, err := object.Stat() if err != nil { |