1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-14 22:47:21 +00:00

Merge two functions with the same content

This commit is contained in:
Lunny Xiao
2024-12-11 22:15:47 -08:00
parent dfd7594499
commit 82ca99db2d
6 changed files with 38 additions and 29 deletions

View File

@ -1132,7 +1132,11 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
}
// Check if current user has fork of repository or in the same repository.
headRepo := repo_model.GetForkedRepo(ctx, headUser.ID, baseRepo.ID)
headRepo, err := repo_model.GetForkedRepo(ctx, headUser.ID, baseRepo.ID)
if err != nil && !repo_model.IsErrRepoNotExist(err) {
ctx.Error(http.StatusInternalServerError, "GetForkedRepo", err)
return nil, nil, nil, "", ""
}
if headRepo == nil && !isSameRepo {
err := baseRepo.GetBaseRepo(ctx)
if err != nil {