Gitlab compare shows more changes than git diff-tree in root branches
Summary
A repository has two branches that do not share a common root. All commits from one branch have been cherry-picked to the second branch, the branch HEAD's trees are identical.
"git diff-tree master second" correctly shows no changes as the branches are identical.
"Gitlab compare" shows the complete branch history as changes, as well in "compare" as in "merge request" mode. All changes are shown as "additions", regardless of the compare order.
Steps to reproduce
git init
git commit -m "Initial commit on master" --allow-empty
git checkout --orphan second
git commit -m "Initial commit on second" --allow-empty
git reset second
git checkout master
echo "A file" > file.txt
git add file.txt
git commit -m "Add a file"
echo ">>> Run diff-tree to show the branches are different"
git diff-tree master second
echo ">>> Cherry-pick all changes to the second branch"
git checkout second
git cherry-pick master
echo ">>> Run diff-tree to show the branches are now identical"
git diff-tree master second
echo ">>> Push to gitlab and run compare. Gitlab will show differences"
# git add remote origin <GITLAB-PROJECT>
# git push origin master second
Example Project
https://gitlab.com/hannibal218bc/test1
What is the current bug behavior?
-
Gitlab "compare master..second" shows all commits as changes, although the changes are already incorporated into the target branch. I think it is especially strange that if you reverse the order to second..master the changes shown are the same - in the test repository, the one changed line of text is always shown as "added", regardless of the direction of the compare?!
-
Gitlab "Create Merge Request master..second" does that as well.
What is the expected correct behavior?
Gitlab Compare output ('changes' tab) should match "git diff-tree". I understand that because of the cherry-picking Gitlab will show all commits not already reflected in the target, but it should show only the actual changes required and not just anything touched by the commits?
Relevant logs and/or screenshots
Please use the links above to view the live results in the test1 repository.
Output of checks
This bug happens on GitLab.com