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

@ -57,14 +57,7 @@ func cloneWiki(ctx context.Context, u *user_model.User, opts migration.MigrateOp
return "", err
}
wikiRepo, err := git.OpenRepository(ctx, wikiPath)
if err != nil {
cleanIncompleteWikiPath()
return "", fmt.Errorf("failed to open wiki repo %q, err: %w", wikiPath, err)
}
defer wikiRepo.Close()
defaultBranch, err := wikiRepo.GetDefaultBranch()
defaultBranch, err := git.GetDefaultBranch(ctx, wikiPath)
if err != nil {
cleanIncompleteWikiPath()
return "", fmt.Errorf("failed to get wiki repo default branch for %q, err: %w", wikiPath, err)