[go: up one dir, main page]

Skip to content

The commit page shows the wrong diff for merge commits

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Problem

When viewing a commit on the GitLab web GUI, the changes shown are not reflective of the actual changes that the commit introduced.

Expected Behavior

The GUI should show all the changes for the commit being viewed.

Details

I have a commit, 933bbec. When I go to https://<gitlab-url>/<user>/<project>/-/commit/933bbec, I see "Showing 5 changed files with 10 additions and 7 deletions."

On the command line, the result of git show -m 933bbec | wc -l is 4305. Commit 933bbec introduces a lot more than 10 additions and 7 deletions.

Why it matters

I found a line that had been deleted in my project and I wanted to know where it got deleted. I tried to do this by looking at various commits on the GitLab GUI to find the latest version of the code that had the now-missing line. I located the commit that removed the line (933bbec), but looking at that commit does not show the line being removed. So essentially the diff on the page for the commit is useless because it's not accurate and it can't be trusted. If a diff isn't showing me the actual changes, then the diff is not helpful. Because of this, I will simply have to avoid using the GitLab GUI to look at commits in the future.

What to do

I don't know what GitLab is doing to generate the diff*, or why it's unable to produce accurate results. Perhaps there is some weird diff algorithm being used. If this is unintentional it should be fixed. If this is intentional, there should be an option on the page to "view real diff" or something so that the page becomes useful for looking at the full changeset of a commit.

*EDIT: see my comment

Edited by 🤖 GitLab Bot 🤖