Skip to content

Teach Danger how to pick up renamed files

Lukas Eipert requested to merge leipert-danger-fix-moved-files into master

What does this MR do?

Danger does not pick up renamed files correctly. If someone uses git.modified_files of the Danger DSL, it will pick up the file name before the rename.

Consider these changes:

  • A new_file.rb
  • D deleted_file.rb
  • M modified_file.rb
  • R renamed_file_before.rb -> renamed_file_after.rb

If you use the pattern git.added_files + git.modified_files you'll end up with [ 'new_file.rb', 'modified_file.rb', 'renamed_file_before.rb' ].

This MR introduces a new helper plugin common_helpers. common_helpers.all_changed_files will return: [ 'new_file.rb', 'modified_file.rb', 'renamed_file_after.rb' ] for the changes above.

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52783

Does this MR meet the acceptance criteria?

Edited by Lukas Eipert

Merge request reports

Loading