Skip to content

Support supressing text file diffs on the default branch with .gitattributes

This change allows users to suppress diffs for text files by adding an entry to the .gitattributes file. To take effect the file present at the HEAD of the default branch.

When rendering a diff, if the file is text according to the charlock holmes gem (via the text? method) but the file is not diffable according to the project repository, then a message is displayed stating that the diff was suppressed.

image

I looked into ways to do this using a binary flag as suggested by @stanhu in this comment, however, there was no good way to seperate what was a real binary file from one that had been marked as not diffable in .gitattributes.

Fixes and closes gitlab-org/gitlab-ce#2315.

Merge request reports