From 49874b7aadd717d174ded1cd54db88298a5b7afb Mon Sep 17 00:00:00 2001 From: Johan Van de Wauw Date: Mon, 24 Oct 2022 05:19:21 +0200 Subject: [PATCH] dump: Add option to skip index dirs (#21501) closes #20683 Add an option to gitea dump to skip the bleve indexes, which can become quite large (in my case the same size as the repo's) and can be regenerated after restore. Co-authored-by: Lunny Xiao Co-authored-by: zeripath --- cmd/dump.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/dump.go b/cmd/dump.go index 73c2251b9..6569fb6e3 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -146,6 +146,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`, Name: "skip-package-data", Usage: "Skip package data", }, + cli.BoolFlag{ + Name: "skip-index", + Usage: "Skip bleve index data", + }, cli.GenericFlag{ Name: "type", Value: outputTypeEnum, @@ -327,6 +331,11 @@ func runDump(ctx *cli.Context) error { excludes = append(excludes, opts.ProviderConfig) } + if ctx.IsSet("skip-index") && ctx.Bool("skip-index") { + excludes = append(excludes, setting.Indexer.RepoPath) + excludes = append(excludes, setting.Indexer.IssuePath) + } + excludes = append(excludes, setting.RepoRootPath) excludes = append(excludes, setting.LFS.Path) excludes = append(excludes, setting.Attachment.Path)