danger / danger/danger-js

Renamed files appear within modified_files, but fail when passed to danger.git.diffForFile

Open
#481 8 comments 8 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.5k
Forks
381
Avg merge
2h 8m
Merged PRs (30d)
6

Description

I've got a file within my repo which has had a parent folder renamed
(e.g. from `/tests/seach/index.spec.js` to `/tests/search/index.spec.js`)

I'm running some tests on the diff of modified files, and this renamed (but not modified) file is turning up within `danger.git.modified_files`.

It appears that when I run `danger.git.diffForFile` on the file's path, danger fires off 1 request for the branch file (which succeeds) and 1 request for the master file using the new path (which fails, 404).

I'd expect Danger to either:
- Know that the file has been renamed but not modified, not include it within `danger.git.modified_files`
- If that's not possible then include it within `danger.git.created_files`
- Handle renames, request the old version using the old name (if possible?)
- More graceful handling / error reporting of 404s during the requests for diffs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.