mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 17:17:19 +00:00
Don't create duplicated functions for code repositories and wiki repositories (#33924)
Fix https://github.com/go-gitea/gitea/pull/33910#pullrequestreview-2688913865 This PR changed the Repositroy interface in `gitrepo` package which makes it only focus the relative path in the disk and abstract whether it's a wiki repository or not.
This commit is contained in:
@ -215,12 +215,24 @@ func init() {
|
||||
db.RegisterModel(new(Repository))
|
||||
}
|
||||
|
||||
func (repo *Repository) GetName() string {
|
||||
return repo.Name
|
||||
func RelativePath(ownerName, repoName string) string {
|
||||
return strings.ToLower(ownerName) + "/" + strings.ToLower(repoName) + ".git"
|
||||
}
|
||||
|
||||
func (repo *Repository) GetOwnerName() string {
|
||||
return repo.OwnerName
|
||||
// RelativePath should be an unix style path like username/reponame.git
|
||||
func (repo *Repository) RelativePath() string {
|
||||
return RelativePath(repo.OwnerName, repo.Name)
|
||||
}
|
||||
|
||||
type StorageRepo string
|
||||
|
||||
// RelativePath should be an unix style path like username/reponame.git
|
||||
func (sr StorageRepo) RelativePath() string {
|
||||
return string(sr)
|
||||
}
|
||||
|
||||
func (repo *Repository) WikiStorageRepo() StorageRepo {
|
||||
return StorageRepo(strings.ToLower(repo.OwnerName) + "/" + strings.ToLower(repo.Name) + ".wiki.git")
|
||||
}
|
||||
|
||||
// SanitizedOriginalURL returns a sanitized OriginalURL
|
||||
|
Reference in New Issue
Block a user