Some refactors about GetMergeBase (#36186)

Maybe fix #32018

- Use `gitrepo.GetMergeBase` method instead of other two
implementations.
- Add `FetchRemoteCommit` so that we don't need to add many `remote` to
the git repository to avoid possible git lock conflicts. A lock will
start when invoke the function, it will be invoked when cross-repository
comparing. The head repository will fetch the base repository's base
commit id. In most situations, it should lock the fork repositories so
that it should not become a bottleneck.
- Improve `GetCompareInfo` to remove unnecessarily adding remote.
- Remove unnecessary parameters of `SignMerge`.
This commit is contained in:
Lunny Xiao
2026-01-17 11:22:09 -08:00
committed by GitHub
parent 149f7a6f1f
commit fafd1db19e
12 changed files with 113 additions and 129 deletions

View File

@@ -238,7 +238,7 @@ func isSignedIfRequired(ctx context.Context, pr *issues_model.PullRequest, doer
}
defer closer.Close()
sign, _, _, err := asymkey_service.SignMerge(ctx, pr, doer, gitRepo, pr.BaseBranch, pr.GetGitHeadRefName())
sign, _, _, err := asymkey_service.SignMerge(ctx, pr, doer, gitRepo)
return sign, err
}