The original approach resulted in orphan commits on the page being displayed on the first branch, and in unnecessary offsets.
Solution: Always begin indexing from the latest commit, then index the heads present on the page, and finally index the orphan commits present on the page.
Patch by Leonid Murin (user:murin).
git-svn-id: https://svn.redmine.org/redmine/trunk@24257 e93f8b46-1217-0410-a6f0-8f06a7374b81