danger-js
danger-js copied to clipboard
[BUG] git diff with colorized output may not be parseable by danger
Describe the bug Local git diff can fail if git diff coloring is enabled
To Reproduce Steps to reproduce the behavior:
-
yarn danger local --base <some-branch> - See that no files have changed, even though same git commands printed by danger with
DEBUG='*'render a diff when run manually -
git config --global color.ui false -
yarn danger local --base <some-branch>works as expected
Expected behavior
yarn danger local --base <some-branch> renders a diff: danger.git.*_files returns the correct file lists
Screenshots N/A
Your Environment
| software | version |
|---|---|
| danger.js | 10.6.6 |
| node | 14.x |
| npm | 6.x |
| Operating System | Git 2.33.0 on Arch Linux |
Additional context
git has a --no-color option that can be passed to git diff, which could be used to help here.
Hah, I think we just pipe out to the git client - maybe there's a way to request no-colors?
Yup! I actually suggested it above. You can pass --no-color to git diff to force to not colorize output.