mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 14:03:24 +09:00
refactor: clean up git repo and model migration packages (#38564)
enable the golangci depguard lint rule: deny "models" and its sub packages in "modelmigration" package.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// Copyright 2026 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package gitrepo
|
||||
|
||||
import "strings"
|
||||
|
||||
func RepoCodeGitRepoRelativePath(ownerName, repoName string) string {
|
||||
return strings.ToLower(ownerName) + "/" + strings.ToLower(repoName) + ".git"
|
||||
}
|
||||
|
||||
func RepoWikiGitRepoRelativePath(ownerName, repoName string) string {
|
||||
return strings.ToLower(ownerName) + "/" + strings.ToLower(repoName) + ".wiki.git"
|
||||
}
|
||||
|
||||
// CodeRepoByName returns an unmanaged repository facade for the code repository of the given owner and repository name.
|
||||
// Usually it is used for migration fixes or repository adoption/creation/rename/transfer.
|
||||
func CodeRepoByName(ownerName, repoName string) RepositoryFacade {
|
||||
return RepositoryUnmanaged(RepoCodeGitRepoRelativePath(ownerName, repoName))
|
||||
}
|
||||
|
||||
func WikiRepoByName(ownerName, repoName string) RepositoryFacade {
|
||||
return RepositoryUnmanaged(RepoWikiGitRepoRelativePath(ownerName, repoName))
|
||||
}
|
||||
Reference in New Issue
Block a user