insights: gitFirstEverCommit can return any commit without a head instead of simply oldest
Created by: coury-clark
Unfortunately, there is another bug that caused the first search to be pre-empted as well. As an optimization we preemptively remove any queries that would fall before the earliest commit in the repo. We load the oldest commit; however, the code that finds the oldest commit in the repo can return a commit that isn't the oldest commit, but is just a commit that has no parent commit.
In this case there are 5 commits that can be "no parent", and only one of them would have triggered a search on the first data point.
Originally posted by @coury-clark in https://github.com/sourcegraph/sourcegraph/issues/30255#issuecomment-1026190792
The end result is that any repo with multiple HEAD revisions can queue up an incorrect backfill depending on how rev-list
returns.