Hi to all,

I`m using Git for Windows mainly for now, where the issue is probably more 
(or only) pronounced, yet I kind of feel this might be of interest across 
platforms (for Git in general), as it makes cross-platform collaboration 
harder than it needs to be (or so it seems to me). I`m posting here and not 
on the main Git mailing list as this topic might be very well elaborated 
till now, so not to produce unnecessary noise there.

When creating a patch, Git exports line endings as they are in the file 
(usually CR+LF on Windows), yet when you apply the patch, it warns you of 
"whitespace errors" (caused by CR part) - even though no whitespace 
actually changed (both old and new hunk have the same CR+LF line endings).

Now, I may understand that in Unix world there was a need to consider 
anything other than LF line ending a "whitespace error" which should be 
reported accordingly, but with Git being widely used across platforms 
nowadays it seems it should know a bit better now, especially when line 
endings *didn`t change in the first place*.

But even worse, if I change the patch file line endings manually to LF and 
git-apply the patch like that - no warning is given, even though line 
endings are in fact different now!

I`m aware of --ws-error-highlight setting for git-diff, allowing to 
show/compare line endings between old/new lines, but manual line comparison 
seems rather impractical in case of applying multiple patches - and yet 
real whitespace errors (actually introduced with the patch we`re applying) 
are lost in the noise (or worse, not even reported, as in CR+LF to LF 
conversion).

Current git-apply --whitespace options seem to allow for a variety of 
settings, but none to warn about *new* whitespace errors *only*, or even 
more important - about line ending changes in general (as converting from 
CRLF to LF might be considered a whitespace error situation, even though 
general Git thinks differently at the moment, probably assuming you 
actually corrected an existing whitespace error... :P).

So, what are the thoughts on this? Would having an additional --whitespace 
option (like "preserve", "warn-new", "warn-changed", or something) to warn 
about *new* whitespace errors *only* make sense in general? Seems so to me, 
but yet as I`m still new around, I might be missing a bigger picture...

p.s. Please let me know if you think this should be reposted to main Git 
mailing list (or to Git for Windows one, even).

Thanks, BugA

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to