mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-29 12:39:54 +00:00
Move git references checking to gitrepo packages to reduce expose of repository path (#33891)
This commit is contained in:
parent
f11ac6bf3c
commit
0056fdb942
24 changed files with 79 additions and 46 deletions
|
@ -47,3 +47,21 @@ func GetDefaultBranch(ctx context.Context, repo Repository) (string, error) {
|
|||
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