This commit is contained in:
Lunny Xiao
2025-12-24 18:22:37 -08:00
parent 10d4361a5c
commit 5e85f8c07c
+6
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