Skip to content

Calculate divergence counts without fetching source branch

Igor Drozdov requested to merge id-fetch-divergence-counts-async into master

What does this MR do and why?

Related issue: #14491 (closed)

Fetching a source branch may be too expensive to do on view. Let's calculate the divergence counts the following way:

  • When a fork is only ahead of the upstream, the latest commit of the upstream exists in the fork and we can calculate the counts within the upstream.

  • When a fork is behind and ahead of the upstream. Considering the fact that a user usually creates a fork to contribute to the upstream, we would expect them to usually have a limited number of ahead commits. Let's take N latest commits of the fork and check their existence upstream. If we can't find those 10 commits upstream, we can just say that the branches diverged and should be resolved locally.

In order to reproduce it:

  • Fork a project
  • Create a commit in the source project.

Screenshot_2022-12-11_at_13.12.16

  • Push more than 10 commits to the fork

Screenshot_2022-12-13_at_12.05.20

Edited by Igor Drozdov

Merge request reports

Loading