diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-07-01 15:47:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-01 15:47:44 +0800 |
commit | 7c1f18a2bb409e2ed669c5e0e6ef8abc9e1a534b (patch) | |
tree | caaed0b4fc68cf6ad13fa32e2f900cce72a608d5 /cmd/dump_repo.go | |
parent | 2eb713bacc202662c875e48c1954e3dd0b73c7b3 (diff) | |
download | gitea-7c1f18a2bb409e2ed669c5e0e6ef8abc9e1a534b.tar.gz gitea-7c1f18a2bb409e2ed669c5e0e6ef8abc9e1a534b.zip |
Fix cli command restore-repo: "units" should be splitted to string slice, to match the old behavior and match the dump-repo's behavior (#20183)
Diffstat (limited to 'cmd/dump_repo.go')
-rw-r--r-- | cmd/dump_repo.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/dump_repo.go b/cmd/dump_repo.go index be0171c9f7..c9d24c6c83 100644 --- a/cmd/dump_repo.go +++ b/cmd/dump_repo.go @@ -134,7 +134,9 @@ func runDumpRepository(ctx *cli.Context) error { } else { units := strings.Split(ctx.String("units"), ",") for _, unit := range units { - switch strings.ToLower(unit) { + switch strings.ToLower(strings.TrimSpace(unit)) { + case "": + continue case "wiki": opts.Wiki = true case "issues": @@ -151,6 +153,8 @@ func runDumpRepository(ctx *cli.Context) error { opts.Comments = true case "pull_requests": opts.PullRequests = true + default: + return errors.New("invalid unit: " + unit) } } } |