Skip to content

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

Screenshot_2023-12-13_at_10.58.30_am

How to set up and validate locally

  1. In rails console enable the experiment fully

    Feature.enable(:collapse_generated_diff_files)
  2. Set any file as a generated file by adding something like abc.txt gitlab-generated to .gitattributes in the target branch

  3. Make a new branch and make some changes to the file you have marked as generated above

  4. Push up the change and open a new merge request

  5. Make sure you have Show whitespace changes option checked as that's the only supported option for now

  6. Observe the file you marked as generated as collapsed and the correct warning shown

  7. 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.

Related to #391777 (closed)

Edited by Sincheol (David) Kim

Merge request reports