mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-05 03:58:28 +02:00
Use new MergeBase method
This commit is contained in:
4 files changed
+9
-42
No files matched your search
@@ -736,7 +736,7 @@ func (g *GiteaLocalUploader) newPullRequest(ctx context.Context, pr *base.PullRe
|
||||
if pr.Base.Ref != "" && pr.Head.SHA != "" {
|
||||
// A PR against a tag base does not make sense - therefore pr.Base.Ref must be a branch
|
||||
// TODO: should we be checking for the refs/heads/ prefix on the pr.Base.Ref? (i.e. are these actually branches or refs)
|
||||
pr.Base.SHA, _, err = g.gitRepo.GetMergeBase("", git.BranchPrefix+pr.Base.Ref, pr.Head.SHA)
|
||||
pr.Base.SHA, err = gitrepo.MergeBase(ctx, g.repo, git.BranchPrefix+pr.Base.Ref, pr.Head.SHA)
|
||||
if err != nil {
|
||||
log.Error("Cannot determine the merge base for PR #%d in %s/%s. Error: %v", pr.Number, g.repoOwner, g.repoName, err)
|
||||
}
|
||||
|
||||
@@ -510,14 +510,7 @@ func checkIfPRContentChanged(ctx context.Context, pr *issues_model.PullRequest,
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
tmpRepo, err := git.OpenRepository(ctx, prCtx.tmpBasePath)
|
||||
if err != nil {
|
||||
return false, "", fmt.Errorf("OpenRepository: %w", err)
|
||||
}
|
||||
defer tmpRepo.Close()
|
||||
|
||||
// Find the merge-base
|
||||
mergeBase, _, err = tmpRepo.GetMergeBase("", "base", "tracking")
|
||||
mergeBase, err = gitrepo.MergeBaseFromRemote(ctx, pr.BaseRepo, pr.HeadRepo, pr.BaseBranch, pr.HeadBranch)
|
||||
if err != nil {
|
||||
return false, "", fmt.Errorf("GetMergeBase: %w", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user