[go: up one dir, main page]

Skip to content

Difference in last line rendering. Browse file two lines, MR - one line.

Summary
There is an inconsistency in how GitLab renders files with a trailing newline (\n):

  • In the file view, the newline is rendered correctly (shown as an empty line).
  • In the diff view, the same newline is not rendered at all — making it appear as if the file ends without one.

Steps to reproduce

  1. Create a new file with a single line ending in a newline character, e.g. FOO=BAR\n.
  2. Commit and push the file to GitLab.
  3. View the file in the repository browser (file view).
  4. View the same file in a merge request or commit diff (diff view).

Environment info

  • GitLab version: Self hosted 18.3.2

  • Reproduced with multiple file types (.env, .conf, .bazeliskrc, .txt)

  • Render the trailing newline in the diff view as an empty line

  • Add visual markers or toggles for end-of-line characters

  • Align the diff view behavior with the file view for consistency

view_mode diff_mode

Edited by 🤖 GitLab Bot 🤖