Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 43,874
    • Issues 43,874
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,382
    • Merge requests 1,382
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #27008
Closed
Open
Created Feb 26, 2019 by James Ramsay (ex-GitLab)@jramsay-gitlab🔴Contributor

Add minimal merge-ref based diff option to merge request comparisons

Problem to solve

Merge request diffs are currently calculated by git diff target...source which compares HEAD of target with the merge base of target and source. This works well until changes from the target branch are merged in to the source branch, creating a complete mess of the diff.

Intended users

Developers

Further details

For a Developer using GitLab, code review is primarily reading the diff generated by GitLab and leaving feedback. If the diff contains changes that have already been merged to the target branch this is:

  1. confusing to the reviewer because they will be seeing unrelated changes in the diff
  2. time consuming for the reviewer because they will have to review a larger diff, and spend more time working out in their head what changes are actually being merged
  3. time consuming for the author who must wait on a longer review cycle and reduce cycle time.

Merge refs will allow us to calculate a more accurate diff that doesn't have these issues.

Proposal

When a person is reading a merge request diff, a new diff mode will be available in the drop down master (HEAD) indicating that this diff is against the head of the target branch, not the merge base of the target and source branch.

Behind the scenes this will use the merge-ref feature implemented for CI.

Screen_Shot_2019-02-26_at_2.21.48_PM

Every time the target branch is updated the merge request diff becomes out of date which happens over 20 times a day for gitlab-ce.

Limitations

In this first iteration:

  • commenting will not be supported on the new master (HEAD) mode
  • instead of automatically recalculating the diff when commits are pushed to the source or target branch, automatically recalculate the diff the next time the merge request is loaded

In the future, the new diff mode will replace the existing diff mode once commenting support is implemented and performance improvements have been made.

Documentation

Testing

What does success look like, and how can we measure that?

GitLab should have accurate diffs that do not show misleading information. Although this is a feature, it is perceived as a bug by our customers who have noted that the diffs in GitHub and Bitbucket better meet their expectations. Thus, success is measured by no long receiving bug reports and support requests about diff accuracy.

Links / references

Edited Jul 01, 2019 by James Ramsay (ex-GitLab)
Assignee
Assign to
Time tracking