Fix wrong commit count in push event payload

Stan Hu requested to merge sh-fix-wrong-commit-count-in-push into master

This fixes a regression in We now only use the full commit count for the initial push to the default branch. Otherwise, we rely on the number of commits that we calculated occurred in the push.

The original behavior in 11.1.4:

  1. When a new branch is pushed, @push_commits_count was set to the total number of refs available for the branch.
  2. For other branches, @push_commits_count would remain nil.
  3. GitPushService#build_push_data would build the push data with @push_commits_count.
  4. If this were nil, it would be set to the right value here:

Broken behavior:

  1. GitPushService#push_commits_count is always called.
  2. The total number of commits is therefore always equal to the total number of refs available.


Edited by Stan Hu

Merge request reports