Merge request diff/changes show older commit if source branch was not rebased prior to creating the MR
Summary
MR Changes show older version of the target branch if the source branch was not updated (rebase) before creating the MR.
Steps to reproduce
- Create a project and in
mainbranch add a file named VERSION with content 0.1. - Create a branch
branch-1. Update VERSION file to have content 1.0. - Update VERSION file in
mainbranch with content 0.2. - Create a new merge request from
branch-1tomain. Scroll down and click Changes tab. It will show change from 0.1 to 1.0 instead of 0.2 to 1.0
Example Project
What is the current bug behavior?
MR diff shows the version of target branch (I believe) from the time branch-1 was last rebased. It doesn't show the latest version of the target branch.
What is the expected correct behavior?
MR diff should show correct version of the target branch files.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com /label reproduced on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
- If the project is not a fork, before creating the MR, update source branch to get changes from target branch (ex rebase).
- If this is happening in a forked project, update your fork before creating the MR.
Edited by Elif Munn
