Skip to content

Commit 53825d8

Browse files
committed
fix backport
1 parent 51a83d6 commit 53825d8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

services/repository/branch.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"code.gitea.io/gitea/modules/optional"
2828
"code.gitea.io/gitea/modules/queue"
2929
repo_module "code.gitea.io/gitea/modules/repository"
30-
"code.gitea.io/gitea/modules/reqctx"
3130
"code.gitea.io/gitea/modules/timeutil"
3231
"code.gitea.io/gitea/modules/util"
3332
webhook_module "code.gitea.io/gitea/modules/webhook"
@@ -647,7 +646,7 @@ type BranchDivergingInfo struct {
647646
}
648647

649648
// GetBranchDivergingInfo returns the information about the divergence of a patch branch to the base branch.
650-
func GetBranchDivergingInfo(ctx reqctx.RequestContext, baseRepo *repo_model.Repository, baseBranch string, headRepo *repo_model.Repository, headBranch string) (*BranchDivergingInfo, error) {
649+
func GetBranchDivergingInfo(ctx context.Context, baseRepo *repo_model.Repository, baseBranch string, headRepo *repo_model.Repository, headBranch string) (*BranchDivergingInfo, error) {
651650
headGitBranch, err := git_model.GetBranch(ctx, headRepo.ID, headBranch)
652651
if err != nil {
653652
return nil, err
@@ -673,10 +672,12 @@ func GetBranchDivergingInfo(ctx reqctx.RequestContext, baseRepo *repo_model.Repo
673672
return info, nil
674673
}
675674
// if the base's update time is before the fork, check whether the base's head is in the fork
676-
headGitRepo, err := gitrepo.RepositoryFromRequestContextOrOpen(ctx, headRepo)
675+
headGitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, headRepo)
677676
if err != nil {
678677
return nil, err
679678
}
679+
defer closer.Close()
680+
680681
headCommit, err := headGitRepo.GetCommit(headGitBranch.CommitID)
681682
if err != nil {
682683
return nil, err

services/repository/merge_upstream.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
user_model "code.gitea.io/gitea/models/user"
1313
"code.gitea.io/gitea/modules/git"
1414
repo_module "code.gitea.io/gitea/modules/repository"
15-
"code.gitea.io/gitea/modules/reqctx"
1615
"code.gitea.io/gitea/modules/util"
1716
"code.gitea.io/gitea/services/pull"
1817
)
@@ -70,7 +69,7 @@ func MergeUpstream(ctx context.Context, doer *user_model.User, repo *repo_model.
7069
}
7170

7271
// GetUpstreamDivergingInfo returns the information about the divergence between the fork repository's branch and the base repository's default branch.
73-
func GetUpstreamDivergingInfo(ctx reqctx.RequestContext, forkRepo *repo_model.Repository, forkBranch string) (*BranchDivergingInfo, error) {
72+
func GetUpstreamDivergingInfo(ctx context.Context, forkRepo *repo_model.Repository, forkBranch string) (*BranchDivergingInfo, error) {
7473
if !forkRepo.IsFork {
7574
return nil, util.NewInvalidArgumentErrorf("repo is not a fork")
7675
}

0 commit comments

Comments
 (0)