Skip to content

Use check_blobs_generated to detect generated files

What does this MR do and why?

This MR implement generated file detection provided by the new check_blobs_generated RPC which utilizes https://github.com/go-enry/go-enry underneath it.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. In rails console enable the experiment fully

    Feature.enable(:collapse_generated_diff_files)
  2. Create a new branch and make changes to any files that https://github.com/go-enry/go-enry would consider as generated such as package-lock.json for example.

  3. Push up the change and open an MR and observe that the file has been collapsed by default. There must be more than 1 changes in the MR to have it collapsed by default.

  4. Verify that you can override that by adding something like package-lock.json -gitlab-generated to .gitattributes to treat that file as not generated. This changes needs to be made in the target branch for it to take effect.

  5. Observe the file is now displayed by default

Related to #435109 (closed)

Edited by Sincheol (David) Kim

Merge request reports