Skip to content

Store the information about the generated files

What does this MR do and why?

Store the information about the generated files

  • Utilize the Compare#generated_files method to set diff files as generated
  • Add missing generated column for ContextCommit
  • Add collapse_generated_diff_files feature flag

NOTE: We're just setting the generated field for now in this MR and there are no user facing changes.

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
  5. Observe the file has been set as generated. MergeRequest.last.merge_request_diff.merge_request_diff_files.find_by(old_path: 'abc.txt') should return a MergeRequestDiffFile with the generated set to true

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 #391776 (closed)

Edited by Sincheol (David) Kim

Merge request reports