Skip to content

Commit b005e6f

Browse files
fix(gitlab): always re-collect MR commits regardless of MR updated_at… (#8959)
* fix(gitlab): always re-collect MR commits regardless of MR updated_at to prevent missing commits in incremental runs * fix(gitlab): correct if-brace syntax in GetMergeRequestsIterator
1 parent 82cab8b commit b005e6f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

backend/plugins/gitlab/tasks/shared.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,14 @@ func GetMergeRequestsIterator(taskCtx plugin.SubTaskContext, apiCollector *api.S
195195
}
196196
if apiCollector != nil {
197197
if apiCollector.GetSince() != nil {
198-
clauses = append(clauses, dal.Where("gitlab_updated_at > ?", *apiCollector.GetSince()))
198+
// Filter by the LATER of gitlab_updated_at or commit_updated_at.
199+
// Using only gitlab_updated_at misses MRs where new commits were pushed
200+
// without the MR itself being updated (e.g. force-pushed commits).
201+
// COALESCE handles MRs with no recorded commit_updated_at.
202+
clauses = append(clauses, dal.Where(
203+
`GREATEST(gmr.gitlab_updated_at, COALESCE(gmr.commit_updated_at, gmr.gitlab_updated_at)) > ?`,
204+
*apiCollector.GetSince(),
205+
))
199206
}
200207
}
201208
// construct the input iterator

0 commit comments

Comments
 (0)