[Koha-devel] Git whitespace whining

Jerry Van Baren vanbargw at gmail.com
Fri Dec 5 04:46:56 CET 2008


Rick Welykochy wrote:
> Jerry Van Baren wrote:
> 
>> Rick Welykochy wrote:
>>> I you disagree then please provide an example of a source code file,
>>> language processor or other instance where trailing white space actaully
>>> can cause trouble. I'm at a loss to find such.
>> The problem is that whitespace causes totally unnecessary merge 
>> conflicts.  The result is you (or worse, an upstream maintainer) wastes 
>> valuable time picking through merge conflicts that should not have 
>> happened.  Bugs are inevitably introduced when a merge conflict is 
>> resolved incorrectly.
> 
> Thanks for the wisdom of experience. I've never experienced white space
> hell using CVS. Perhaps it is more of a problem in git.

Maybe.  I suspect is is more how CVS is used and its limitations than 
git per se.  Possibly CVS ignored the whitespace issue.  CVS doesn't do 
branching and merging well.
   <http://www.youtube.com/watch?v=4XpnKHJAok8>

Git excels at branching and merging.  The whitespace issue is critical 
when merging is critical: in a distributed repository, merging is what 
makes it work - merging is beyond critical, it is the enabler technology.

> The only way I got around this on my first commit + patch cycle was to
> fix the problem.
> 
> I've decided to leave the warning on and fix as I go. It only takes a
> few seconds to search for and replace trailing whitespace or whitespace
> lines. How did they get there in the first place? <mouth wide shut/>

In WindowsWorld, I've found UltraEdit adds whitespace damage.  Visual 
SlickEdit shotguns a truly appalling amount of whitespace crap every 
time you blink.

Your whitespace is likely added by the editor that you use.  The other 
possibility is that it is in the master repository (which I was thinking 
when I sent the last message... easy enough to check, but I have not had 
time to check).

The good news is you typically can configure editors to strip trailing 
whitespace when you save the file.  The bad news is UltraEdit and 
SlickEdit come with that turned off (WHY???  It seems pretty stupid to 
add lots of arbitrary trailing whitespace to a file regardless of 
repository issues).  The worse news is that in SlickEdit it is hard to 
find where the control is (sorry, I'm not at work so I cannot look where 
it is).

>> This will be painful, but it is painful only once.  Leaving whitespace 
>> damage in the source will be a never ending source of pain (death by 
>> 1,000 paper cuts).
> 
> Peculiar to git, perhaps?

Peculiar to merging... which is the core requirement of distributed 
repositories.  FWIIW, my painful experience was with Mercurial, not git, 
but it is the same issue: merging.

BTW, beyond the merge problem (which is significant), IMHO whitespace 
damage is a "broken window" issue.  If you make sure the little stuff is 
clean, it sets a level of expectation and everything will be clean(er).
   <http://en.wikipedia.org/wiki/Fixing_Broken_Windows>

> cheers
> rickw

HTH,
gvb



More information about the Koha-devel mailing list