diff options
author | Johan Van de Wauw <johan@gisky.be> | 2021-04-12 11:33:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 17:33:32 +0800 |
commit | 6d2866f20c7ba725a02d8ecdd42810291ef4f97c (patch) | |
tree | 4d21142c38ac638177e35812086863dc9ed81f06 /cmd/dump.go | |
parent | db4acd864f6430735ac4f7073e4daac4e533ea39 (diff) | |
download | gitea-6d2866f20c7ba725a02d8ecdd42810291ef4f97c.tar.gz gitea-6d2866f20c7ba725a02d8ecdd42810291ef4f97c.zip |
dump: Add option to skip LFS/attachment files (#15407)
* Add option to skip dumping LFS/attachment files
* Fix fmt issues
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'cmd/dump.go')
-rw-r--r-- | cmd/dump.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cmd/dump.go b/cmd/dump.go index 43997c8da8..458f9f91e0 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -129,6 +129,14 @@ It can be used for backup and capture Gitea server image to send to maintainer`, Name: "skip-custom-dir", Usage: "Skip custom directory", }, + cli.BoolFlag{ + Name: "skip-lfs-data", + Usage: "Skip LFS data", + }, + cli.BoolFlag{ + Name: "skip-attachment-data", + Usage: "Skip attachment data", + }, cli.GenericFlag{ Name: "type", Value: outputTypeEnum, @@ -214,7 +222,9 @@ func runDump(ctx *cli.Context) error { fatal("Failed to include repositories: %v", err) } - if err := storage.LFS.IterateObjects(func(objPath string, object storage.Object) error { + if ctx.IsSet("skip-lfs-data") && ctx.Bool("skip-lfs-data") { + log.Info("Skip dumping LFS data") + } else if err := storage.LFS.IterateObjects(func(objPath string, object storage.Object) error { info, err := object.Stat() if err != nil { return err @@ -313,7 +323,9 @@ func runDump(ctx *cli.Context) error { } } - if err := storage.Attachments.IterateObjects(func(objPath string, object storage.Object) error { + if ctx.IsSet("skip-attachment-data") && ctx.Bool("skip-attachment-data") { + log.Info("Skip dumping attachment data") + } else if err := storage.Attachments.IterateObjects(func(objPath string, object storage.Object) error { info, err := object.Stat() if err != nil { return err |