tags:

views:

91

answers:

3

Hi,

Is there a way to tell what I am committing to git does not contain whitespace errors? I currently is viewing it in my editor line by line. That is very slow and painful.

Thank you for any suggestion.

+1  A: 

try this

git config —global apply.whitespace nowarn
BioBuckyBall
Thanks. But I want to know if there is whitespace error, so why I set the above the 'nowarn', isn't that is opposite of what I want?
hap497
like the others, I'm not quite sure what you mean by whitespace <i>errors</i>. I assumed you were trying to ignore whitespace changes. version control systems usually default to <i>not</i> ignoring whitespace. You will have to define what you mean.
BioBuckyBall
+1  A: 

Define 'whitespace error'. Put that definition in a hook script (.git/hooks/pre-commit) which checks the patch that you are attempting to commit and fails if it contains one.

William Pursell
+1  A: 

Do you have default pre-commit hook turned on? It includes whitespace check (of a changed part). You can configure git to tell it what it should consider whitespace error; also if you use color diff then you can tell git to color whitespace errors in diff (including "git show <commit>" output).

Jakub Narębski