Closed lode closed 2 years ago
Yeah, perhaps the command we run under the hood can be explicit in requiring the prefixes from git, I'm open to PRs there
:+1: I'm willing to try a PR, ~though I couldn't find where this was ran. Can you give me a pointer?~
~Diving a little deeper.~
~If I understand correctly this is called in https://github.com/danger/danger-js/blob/main/source/platforms/git/diffToGitJSONDSL.ts. It relies on parseDiff
, and also does an assumption itself on the prefixes: https://github.com/danger/danger-js/blob/main/source/platforms/git/diffToGitJSONDSL.ts#L20.~
~I get the feeling this should first be fixed in https://github.com/sergeyt/parse-diff. Is that correct?~
Sorry for the monologue, but I think I found a place in this repo. I'll try a little and will stop spamming here for a while :)
Describe the bug When having git configured to hide prefixes on file names in the diff output (https://git-scm.com/docs/git-config#Documentation/git-config.txt-diffnoprefix) fetching a list of changed files fails.
To Reproduce Steps to reproduce the behavior:
danger local
(maybe also works with ci)git config --global diff.noprefix "true"
danger local
(maybe also works with ci)Expected behavior It should work also when people configure git in a different way. I think it is also possible, depending on how we get the diff output. At least running
git diff --src-prefix="a/" --dst-prefix="b/"
forces needed prefixes even though the global config is set to remove them.Additional context If of any interest, I'm using
danger.git.fileMatch
,danger.git.created_files
,danger.git.modified_files
,danger.git.structuredDiffForFile
in my dangerfile. However, it seems to trigger regardless, even on an empty dangerfile.