Fix wrong commit count in push event payload
This fixes a regression in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20916. 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: https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.1.4/lib/gitlab/data_builder/push.rb#L60 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. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/49971
Showing
Please register or sign in to comment