mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-29 12:39:54 +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:
parent
e25f860735
commit
a9e8ac0fe0
20 changed files with 56 additions and 77 deletions
|
@ -44,24 +44,12 @@ func GetDefaultBranch(ctx context.Context, repo Repository) (string, error) {
|
|||
return git.GetDefaultBranch(ctx, repoPath(repo))
|
||||
}
|
||||
|
||||
func GetWikiDefaultBranch(ctx context.Context, repo Repository) (string, error) {
|
||||
return git.GetDefaultBranch(ctx, wikiPath(repo))
|
||||
}
|
||||
|
||||
// IsReferenceExist returns true if given reference exists in the repository.
|
||||
func IsReferenceExist(ctx context.Context, repo Repository, name string) bool {
|
||||
return git.IsReferenceExist(ctx, repoPath(repo), name)
|
||||
}
|
||||
|
||||
func IsWikiReferenceExist(ctx context.Context, repo Repository, name string) bool {
|
||||
return git.IsReferenceExist(ctx, wikiPath(repo), name)
|
||||
}
|
||||
|
||||
// IsBranchExist returns true if given branch exists in the repository.
|
||||
func IsBranchExist(ctx context.Context, repo Repository, name string) bool {
|
||||
return IsReferenceExist(ctx, repo, git.BranchPrefix+name)
|
||||
}
|
||||
|
||||
func IsWikiBranchExist(ctx context.Context, repo Repository, name string) bool {
|
||||
return IsWikiReferenceExist(ctx, repo, git.BranchPrefix+name)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue