-
-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renamed files appear within modified_files, but fail when passed to danger.git.diffForFile #481
Comments
I agree, that logic should be pretty feasible to look up using the existing calls we have (e.g. inside the diff we get) then to use that instead of simply looking for the same named file twice |
I've also ran into the issues described above with renamed folders, and agree that it shouldn't be included in |
On a related note, when I have a new file added and try to run
But if I change it to |
I spoke too soon - it reports an empty diff if I use |
Experiencing this, although I'm not sure it's a major issue. How can we tell that a file has been renamed? |
This hasn't been fixed yet, although #1197 seems to think it has. |
for now we're having to preempt failing cases :( const invalidFiles = (
await Promise.all(
changedPackageJsons.map(async (filename) => {
try {
await execasync(`git show master:"${filename}"`);
} catch (error) {
return {};
}
const diff = await danger.git.JSONDiffForFile(filename);
return {
filename,
versionChanged: Object.keys(diff).includes('version'),
};
})
)
).filter(({ versionChanged }) => versionChanged); |
I see that the ruby version of danger has a dedicated renamed_files getter in its git API. What's surprising is that the deleted_files getter prefixes its path with Instead, the renaming is treated like a simple modification and only gives the renamed path. This is a very confusing behavior. |
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:
danger.git.modified_files
danger.git.created_files
The text was updated successfully, but these errors were encountered: