From e6dc1862ec58e65d68fe550eb01e529a2afec121 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 28 May 2025 04:00:12 +0800 Subject: [PATCH] add comment for CalcCommitStatus --- models/git/commit_status.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/models/git/commit_status.go b/models/git/commit_status.go index fab64c1fb4..efe922ca38 100644 --- a/models/git/commit_status.go +++ b/models/git/commit_status.go @@ -230,6 +230,10 @@ func (status *CommitStatus) HideActionsURL(ctx context.Context) { // CalcCommitStatus returns commit status state via some status, the commit statues should order by id desc func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus { + // This function is widely used, but it is not quite right. + // The bad case is: if all commits are "skipped", GitHub will return "success" as the combined status. + // But here Gitea just returns the first status, which is still "skipped" in this case. + // Ideally it should return something like "CommitStatusSummary" with proper aggregated state. var lastStatus *CommitStatus state := api.CommitStatusSuccess for _, status := range statuses {