[status] Filter out "new" commits which are not in the window
Change-Id: I30dfb5e82f7e0c2fdf9ffee9766cf9a239b987fe
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/236876
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
diff --git a/status/go/incremental/commits.go b/status/go/incremental/commits.go
index 98e11aa..e6171ca 100644
--- a/status/go/incremental/commits.go
+++ b/status/go/incremental/commits.go
@@ -67,8 +67,15 @@
// Add any new commits to the return value. The branch heads get
// updated if there are any new commits OR if the branch heads
// have changed (eg. in the case of a reset or empty merge).
- if reset || len(newCommits) > 0 {
- rvCommits[repoUrl] = newCommits
+ if len(newCommits) > 0 {
+ // Only add new commits which are in the window.
+ filtered := make([]*vcsinfo.LongCommit, 0, len(newCommits))
+ for _, c := range newCommits {
+ if w.TestTime(repoUrl, c.Timestamp) {
+ filtered = append(filtered, c)
+ }
+ }
+ rvCommits[repoUrl] = filtered
rvBranchHeads[repoUrl] = bh
} else if !reflect.DeepEqual(c.oldBranchHeads[repoUrl], bhMap) {
rvBranchHeads[repoUrl] = bh