diff options
author | zeripath <art27@cantab.net> | 2022-11-15 08:08:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-15 16:08:59 +0800 |
commit | c772934ff623b3a76efbe306f597695330a71287 (patch) | |
tree | 4639644b2bcc0e8ee3573283c8c7190a80b24a59 /modules/git | |
parent | de6dfb714153c17a06406c866805a17a476c63bd (diff) | |
download | gitea-c772934ff623b3a76efbe306f597695330a71287.tar.gz gitea-c772934ff623b3a76efbe306f597695330a71287.zip |
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 <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/git')
-rw-r--r-- | modules/git/repo_archive.go | 12 |
1 files changed, 12 insertions, 0 deletions
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" { |