0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-01-25 04:11:05 +01:00
This commit is contained in:
Lunny Xiao 2025-12-24 18:22:37 -08:00
parent 10d4361a5c
commit 5e85f8c07c
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A

View File

@ -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