dump: add option to skip repository archives data

One might want to exclude this data when dumping, esp. since repository
archives are more of temporary data by nature.

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-12-29 19:52:10 +01:00
parent 4ed10f782b
commit e8a022ac9a
No known key found for this signature in database
GPG key ID: 73D5E7FDEE3DE49A

View file

@ -160,6 +160,10 @@ It can be used for backup and capture Forgejo server image to send to maintainer
Name: "skip-index",
Usage: "Skip bleve index data",
},
&cli.BoolFlag{
Name: "skip-repo-archives",
Usage: "Skip repository archives",
},
&cli.GenericFlag{
Name: "type",
Value: outputTypeEnum,
@ -360,6 +364,11 @@ func runDump(ctx *cli.Context) error {
excludes = append(excludes, setting.Indexer.IssuePath)
}
if ctx.IsSet("skip-repo-archives") && ctx.Bool("skip-repo-archives") {
log.Info("Skipping repository archives data")
excludes = append(excludes, setting.RepoArchive.Storage.Path)
}
excludes = append(excludes, setting.RepoRootPath)
excludes = append(excludes, setting.LFS.Storage.Path)
excludes = append(excludes, setting.Attachment.Storage.Path)