Please can you explain about whitespace errors in git, what do they mean, what is 'squelching', and do I need to worry about it?
(Running msysgit, but with other users on linux).
There is already a 'definitive' answer for autocrlf here (set it to false git config --global core.autocrlf false
)
What are considered whitespace errors is controlled by core. whitespace configuration. By default, trailing whitespaces (including lines that solely consist of whitespaces) and a space character that is immediately followed by a tab character inside the initial indent of the line are considered whitespace errors.
Whitespace error can be caused by either an unsupported character or symbol being passed to the gateway, or a blank or white space being left in a field. Most commonly, the Whitespace error is caused by characters or symbols that are not supported by global XML code being passed to the gateway.
Squelching is initially a function used in telecommunication to set a threshold above which a signal is or isn't alllowed through.
In your case, when you see:
warning: squelched 104 whitespace errors warning: 109 lines add whitespace errors.
It means: instead of displaying 100+ error messages, it warns you it should have displayed those errors (but it won't, in order to not clutter the output)
I have no definitive recommendations for whitespace policy, except from identifying why they are introduced in the first place.
If your editor doesn't convert the eol (end of lines) characters between Window and Unix, then it means it somehow add or remove automatically whitespaces, which is not always useful.
A first test (as in this blog post) is to de-activate the policy:
git config core.whitespace nowarn
or try
git config core.whitespace fix
and see if that facilitates your rebase operations.
Here is how to fix "trailing whitespace" errors when using git apply :
The first thing you need to know is : what is a whitespace error. This is explained on the core.whitespace setting documentation. Basically, git handles several kind of whitespace errors :
blank-at-eol blank-at-eof space-before-tab indent-with-non-tab tab-in-indent cr-at-eol
trailing whitespace error can rise when patching a file using windows style line ending (CRLF). To avoid this warning, you can either ask git apply
to not show warning :
git apply --whitespace=nowarn fix.patch
or you can edit git configuration on the fly (with -c
) to say "ok git, CR at end of line are fine this time" :
git -c core.whitespace=cr-at-eol apply fix.patch
If you want to make it permanent, just edit the git configuration like that :
git config apply.whitespace nowarn
or :
git config core.whitespace cr-at-eol
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With