danger-js icon indicating copy to clipboard operation
danger-js copied to clipboard

[BUG] git diff with colorized output may not be parseable by danger

Open benasher44 opened this issue 4 years ago • 2 comments

Describe the bug Local git diff can fail if git diff coloring is enabled

To Reproduce Steps to reproduce the behavior:

  1. yarn danger local --base <some-branch>
  2. See that no files have changed, even though same git commands printed by danger with DEBUG='*' render a diff when run manually
  3. git config --global color.ui false
  4. 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.

benasher44 avatar Sep 30 '21 16:09 benasher44

Hah, I think we just pipe out to the git client - maybe there's a way to request no-colors?

orta avatar Sep 30 '21 20:09 orta

Yup! I actually suggested it above. You can pass --no-color to git diff to force to not colorize output.

benasher44 avatar Sep 30 '21 21:09 benasher44