mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
The downloader spoke to a remote instance through gitea.dev/sdk, the last external dependency this tree could not name for itself. We migrate from GitHub, so the path earned nothing and is gone, along with its service enum name, migrate form, locale string, mock fixtures and icon rules. Enum slot 3 stays reserved: repositories already record it in original_service_type, and renumbering would change what those rows mean. TestDumpRestore went with it. It dumped from our own instance through that downloader, so the round trip has no coverage until a downloader that speaks our own API exists. Co-authored-by: Hanzo Dev <[email protected]>
44 lines
1017 B
Go
44 lines
1017 B
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package convert
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/hanzoai/git/modules/setting"
|
|
"github.com/hanzoai/git/modules/structs"
|
|
)
|
|
|
|
// ToCorrectPageSize makes sure page size is in allowed range.
|
|
func ToCorrectPageSize(size int) int {
|
|
if size <= 0 {
|
|
size = setting.API.DefaultPagingNum
|
|
} else if size > setting.API.MaxResponseItems {
|
|
size = setting.API.MaxResponseItems
|
|
}
|
|
return size
|
|
}
|
|
|
|
// ToGitServiceType return GitServiceType based on string
|
|
func ToGitServiceType(value string) structs.GitServiceType {
|
|
switch strings.ToLower(value) {
|
|
case "github":
|
|
return structs.GithubService
|
|
case "gitlab":
|
|
return structs.GitlabService
|
|
case "gogs":
|
|
return structs.GogsService
|
|
case "onedev":
|
|
return structs.OneDevService
|
|
case "gitbucket":
|
|
return structs.GitBucketService
|
|
case "codebase":
|
|
return structs.CodebaseService
|
|
case "codecommit":
|
|
return structs.CodeCommitService
|
|
default:
|
|
return structs.PlainGitService
|
|
}
|
|
}
|