Skip to content

Commit ca6bcf0

Browse files
committed
improve comments
1 parent 8c21f01 commit ca6bcf0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

models/git/commit_status.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,8 @@ func (status *CommitStatus) HideActionsURL(ctx context.Context) {
231231
// CalcCommitStatus returns commit status state via some status, the commit statues should order by id desc
232232
func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus {
233233
// This function is widely used, but it is not quite right.
234-
// If all commits are "skipped", GitHub will return "success" as the combined status.
235-
// FIXME: But the bad case here is: Gitea just returns the first status, which is still "skipped".
236-
// Ideally it should return something like "CommitStatusSummary" with proper aggregated state.
234+
// Ideally it should return something like "CommitStatusSummary" with properly aggregated state.
235+
// GitHub's behavior: if all statuses are "skipped", GitHub will return "success" as the combined status.
237236
var lastStatus *CommitStatus
238237
state := api.CommitStatusSuccess
239238
for _, status := range statuses {
@@ -244,10 +243,10 @@ func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus {
244243
}
245244
if lastStatus == nil {
246245
if len(statuses) > 0 {
247-
// the bad case mentioned above: only the first status is returned, its status is "skipped"
246+
// FIXME: a bad case: Gitea just returns the first commit status, its status is "skipped" in this case.
248247
lastStatus = statuses[0]
249248
} else {
250-
// FIXME: this is another bad case, if the "statuses" slice is empty, the returned value is an invalid CommitStatus, all its fields are empty.
249+
// FIXME: another bad case: if the "statuses" slice is empty, the returned value is an invalid CommitStatus, all its fields are empty.
251250
lastStatus = &CommitStatus{}
252251
}
253252
}

0 commit comments

Comments
 (0)