From 5e85f8c07cb1ad5a37a096cb4dd7a98deefa256c Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 24 Dec 2025 18:22:37 -0800 Subject: [PATCH] Fix bug --- services/pull/compare.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/pull/compare.go b/services/pull/compare.go index 00a74f2972..ce9210b22d 100644 --- a/services/pull/compare.go +++ b/services/pull/compare.go @@ -57,6 +57,12 @@ func GetCompareInfo(ctx context.Context, baseRepo, headRepo *repo_model.Reposito compareInfo.MergeBase = compareInfo.BaseCommitID } + if baseRepo.ID != headRepo.ID { + if err := gitrepo.FetchRemoteCommit(ctx, headRepo, baseRepo, compareInfo.BaseCommitID); err != nil { + return nil, fmt.Errorf("FetchRemoteCommit: %w", err) + } + } + // Count number of changed files. // This probably should be removed as we need to use shortstat elsewhere // Now there is git diff --shortstat but this appears to be slower than simply iterating with --nameonly