Move get/set default branch from git package to gitrepo package to hide repopath (#29126)

This commit is contained in:
Lunny Xiao 2024-03-08 15:30:10 +08:00 committed by GitHub
parent a1f5dd7677
commit 25b842df26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 52 additions and 63 deletions

View file

@ -375,7 +375,7 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, doer *user_m
log.Error("CancelRunningJobs: %v", err)
}
err2 = gitRepo.SetDefaultBranch(to)
err2 = gitrepo.SetDefaultBranch(ctx, repo, to)
if err2 != nil {
return err2
}
@ -540,7 +540,7 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitR
log.Error("CancelRunningJobs: %v", err)
}
if err := gitRepo.SetDefaultBranch(newBranchName); err != nil {
if err := gitrepo.SetDefaultBranch(ctx, repo, newBranchName); err != nil {
if !git.IsErrUnsupportedVersion(err) {
return err
}