Skip to content

Commit 1bdffef

Browse files
kevans91techknowlogickzeripath
authored
cmd: dump: add an -L/--skip-log option (#11253)
Not all dumps need to include the logs, in a similar vain to not all dumps needing to include repositories; these may be subject to different backup mechanisms/constraints. Add a simple option to let them be excluded from the dump to simplify workflows that need to exclude them or not collect in the first place. Co-authored-by: techknowlogick <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent e9e8638 commit 1bdffef

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cmd/dump.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
5252
Name: "skip-repository, R",
5353
Usage: "Skip the repository dumping",
5454
},
55+
cli.BoolFlag{
56+
Name: "skip-log, L",
57+
Usage: "Skip the log dumping",
58+
},
5559
},
5660
}
5761

@@ -151,7 +155,12 @@ func runDump(ctx *cli.Context) error {
151155
}
152156
}
153157

154-
if com.IsExist(setting.LogRootPath) {
158+
// Doesn't check if LogRootPath exists before processing --skip-log intentionally,
159+
// ensuring that it's clear the dump is skipped whether the directory's initialized
160+
// yet or not.
161+
if ctx.IsSet("skip-log") && ctx.Bool("skip-log") {
162+
log.Info("Skip dumping log files")
163+
} else if com.IsExist(setting.LogRootPath) {
155164
if err := z.AddDir("log", setting.LogRootPath); err != nil {
156165
fatal("Failed to include log: %v", err)
157166
}

0 commit comments

Comments
 (0)