Skip to content

Fix Danger::Helper check for renamed files

What does this MR do?

When file renamed without changes, Danger::DangerfileGitPlugin#diff_for_file returns nil.

The fix checks whether there is a diff for a file and returns early to prevent errors being raised.

Example

!41406 (merged) renames a file without changes (app/assets/javascripts/admin/dev_ops_report/components/usage_ping_disabled.vue), that leads to a broken Danger job.


Job example

https://gitlab.com/gitlab-org/gitlab/-/jobs/726677764

Fixes

Screenshot_2020-09-08_at_18.37.40

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • ~~Label as security and @ mention @gitlab-com/gl-security/appsec~~
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Vitali Tatarintev

Merge request reports