Collapse generated files
What does this MR do and why?
This change allows us to collapse/expand files that are marked as generated. Currently, we can mark them as generated by specifying gitlab-generated
override to .gitattributes
manually. Automatic detection will be handled in follow up MRs. Also, it currently only supports when the user has Show whitespace changes
option enabled.
# example .gitattributes entry
package-lock.json gitlab-generated
Screenshots or screen recordings
How to set up and validate locally
-
In rails console enable the experiment fully
Feature.enable(:collapse_generated_diff_files)
-
Set any file as a generated file by adding something like
abc.txt gitlab-generated
to.gitattributes
in the target branch -
Make a new branch and make some changes to the file you have marked as generated above
-
Push up the change and open a new merge request
-
Make sure you have
Show whitespace changes
option checked as that's the only supported option for now -
Observe the file you marked as generated as collapsed and the correct warning shown
-
Check if you can expand the collapsed file and see the content
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #391777 (closed)