0

If I enter this command in the terminal: git config diff.wsErrorHighlight all (from Coloring white space in git-diff's output.), then my git diff correctly shows removed whitespace highlighted in red.

But, for some reason, if I modify my ~/.gitconfig file to permanently have this change:

 [diff]
     # Automatically detect renames/moves of files in git diffs
     # Shows actual changes between files
     renames = true

     # Shows removed whitespace in diffs
     wsErrorHighlight = all 

this doesn't work. Doing a git diff now doesn't show the removed whitespace highlighted in red.

Shouldn't these two ways produce the same result?

rasen58
  • 4,672
  • 8
  • 39
  • 74
  • 1
    This works fine for me. Can you edit your question to include the version of Git you're using (`git --version`) and the output of `git config -l --show-origin | grep diff`? – bk2204 Jun 27 '19 at 00:02
  • @bk2204 Your `git config -l --show-origin | grep diff` helped me realize the issue. Thanks! – rasen58 Jun 27 '19 at 17:42

1 Answers1

0

Found the problem with the help of @bk2204.

I had originally ran git config diff.wsErrorHighlight all and then git config diff.wsErrorHighlight new in order to reset the diff functionality back to the original.

But, the problem was that this actually added diff.wserrorhighlight=new to the local .git/config of the repo that I was testing this in, and this local config overrode the value from my global config that I had put wsErrorHighlight = all into.

So removing the line from the local config fixed this.

rasen58
  • 4,672
  • 8
  • 39
  • 74