Fix wrong commit count in push event payload
This fixes a regression in !20916 (merged). 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:
- When a new branch is pushed,
@push_commits_countwas set to the total number of refs available for the branch.
- For other branches,
GitPushService#build_push_datawould build the push data with
- If this were
nil, it would be set to the right value here: https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.1.4/lib/gitlab/data_builder/push.rb#L60
GitPushService#push_commits_countis always called.
- The total number of commits is therefore always equal to the total number of refs available.
Closes #49971 (closed)