Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !21338

Fix wrong commit count in push event payload

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Stan Hu requested to merge sh-fix-wrong-commit-count-in-push into master Aug 22, 2018
  • Overview 2
  • Commits 1
  • Pipelines 9
  • Changes 3

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

Edited Aug 22, 2018 by Stan Hu
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: sh-fix-wrong-commit-count-in-push