diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2025-03-15 19:48:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-15 19:48:59 -0700 |
commit | 0056fdb94201f54fcbb51d741a68b04bf41213fc (patch) | |
tree | 5185b6ad1d8c8560e8cb06cb83a60d6c8fc35620 /services/repository | |
parent | f11ac6bf3cb45e01080b1ec5bd9cbdd1ee5cda92 (diff) | |
download | gitea-0056fdb94201f54fcbb51d741a68b04bf41213fc.tar.gz gitea-0056fdb94201f54fcbb51d741a68b04bf41213fc.zip |
Move git references checking to gitrepo packages to reduce expose of repository path (#33891)
Diffstat (limited to 'services/repository')
-rw-r--r-- | services/repository/branch.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/repository/branch.go b/services/repository/branch.go index d0d8851423..8804778bd5 100644 --- a/services/repository/branch.go +++ b/services/repository/branch.go @@ -410,11 +410,11 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_m return "target_exist", nil } - if gitRepo.IsBranchExist(to) { + if gitrepo.IsBranchExist(ctx, repo, to) { return "target_exist", nil } - if !gitRepo.IsBranchExist(from) { + if !gitrepo.IsBranchExist(ctx, repo, from) { return "from_not_exist", nil } @@ -618,12 +618,12 @@ func AddAllRepoBranchesToSyncQueue(ctx context.Context) error { return nil } -func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, newBranchName string) error { +func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, newBranchName string) error { if repo.DefaultBranch == newBranchName { return nil } - if !gitRepo.IsBranchExist(newBranchName) { + if !gitrepo.IsBranchExist(ctx, repo, newBranchName) { return git_model.ErrBranchNotExist{ BranchName: newBranchName, } |