metablaster
metablaster

Reputation: 2184

Use git diff to show only whitespace errors as defined in .gitattributes?

In .gitattributes I define what sorts of whitespaces should git diff treat as errors, for example:

*.xml whitespace=trailing-space,space-before-tab,indent-with-non-tab,tabwidth=2

The whitespace in this example option tells that git diff should treat specified kinds of whitespaces as errors for xml files.

When git diff is run against some xml file and finds those whitespace problems it will mark them with red background color, in the example bellow there are multiple whitespaces before tab as they are marked with red square for all the whitespaces:

enter image description here

What I want to achieve with git diff is to show me ONLY lines whitespace errors and no other code changes, is that possible and how?

Code changes which contain no whitespace errors should not be shown to reduce output only to whitespace errors.

Upvotes: 0

Views: 204

Answers (0)

Related Questions