From c772934ff623b3a76efbe306f597695330a71287 Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 15 Nov 2022 08:08:59 +0000 Subject: Adjust gitea doctor --run storages to check all storage types (#21785) The doctor check `storages` currently only checks the attachment storage. This PR adds some basic garbage collection functionality for the other types of storage. Signed-off-by: Andrew Thornton Co-authored-by: Lunny Xiao --- modules/git/repo_archive.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/git') diff --git a/modules/git/repo_archive.go b/modules/git/repo_archive.go index a0cbfba5d9..13be2004ca 100644 --- a/modules/git/repo_archive.go +++ b/modules/git/repo_archive.go @@ -38,6 +38,18 @@ func (a ArchiveType) String() string { return "unknown" } +func ToArchiveType(s string) ArchiveType { + switch s { + case "zip": + return ZIP + case "tar.gz": + return TARGZ + case "bundle": + return BUNDLE + } + return 0 +} + // CreateArchive create archive content to the target path func (repo *Repository) CreateArchive(ctx context.Context, format ArchiveType, target io.Writer, usePrefix bool, commitID string) error { if format.String() == "unknown" { -- cgit v1.2.3