mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 23:16:52 +02:00
fix: avoid FetchRemoteTempCommit touching unnecessary resources (#39583)
Also rename FetchRemoteCommit to FetchRemoteTempCommit to clarify its purpose
This commit is contained in:
1 parent
b576f5bb34
commit
49adfd065d
4 files changed
+15
-24
No files matched your search
@@ -73,8 +73,8 @@ func GetCompareInfo(ctx context.Context, baseRepo, headRepo *repo_model.Reposito
|
||||
if baseRepo.ID != headRepo.ID {
|
||||
exist := headGitRepo.IsReferenceExist(ctx, compareInfo.BaseCommitID)
|
||||
if !exist {
|
||||
if err := git.FetchRemoteCommit(ctx, headRepo, baseRepo, compareInfo.BaseCommitID); err != nil {
|
||||
return compareInfo, fmt.Errorf("FetchRemoteCommit: %w", err)
|
||||
if err := git.FetchRemoteTempCommit(ctx, headRepo, baseRepo, compareInfo.BaseCommitID); err != nil {
|
||||
return compareInfo, fmt.Errorf("FetchRemoteTempCommit: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,11 +90,10 @@ func checkPullRequestMergeableByMergeTree(ctx context.Context, pr *issues_model.
|
||||
}
|
||||
|
||||
// 4. fetch head commit id into the current repository
|
||||
// it will be checked in 2 weeks by default from git if the pull request created failure.
|
||||
if !pr.IsSameRepo() {
|
||||
if !baseGitRepo.IsReferenceExist(ctx, pr.HeadCommitID) {
|
||||
if err := git.FetchRemoteCommit(ctx, pr.BaseRepo, pr.HeadRepo, pr.HeadCommitID); err != nil {
|
||||
return fmt.Errorf("FetchRemoteCommit: %w", err)
|
||||
if err := git.FetchRemoteTempCommit(ctx, pr.BaseRepo, pr.HeadRepo, pr.HeadCommitID); err != nil {
|
||||
return fmt.Errorf("FetchRemoteTempCommit: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user