Browse Source

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>
tags/v1.15.0-rc1
Johan Van de Wauw 3 years ago
parent
commit
6d2866f20c
No account linked to committer's email address
1 changed files with 14 additions and 2 deletions
  1. 14
    2
      cmd/dump.go

+ 14
- 2
cmd/dump.go View File

Name: "skip-custom-dir", Name: "skip-custom-dir",
Usage: "Skip custom directory", 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{ cli.GenericFlag{
Name: "type", Name: "type",
Value: outputTypeEnum, Value: outputTypeEnum,
fatal("Failed to include repositories: %v", err) 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() info, err := object.Stat()
if err != nil { if err != nil {
return err return err
} }
} }


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() info, err := object.Stat()
if err != nil { if err != nil {
return err return err

Loading…
Cancel
Save