A 'git' bug has been reported some times ago by Tor Lillqvist. the
symptom was that on a partial commit the rest of the changes (the
uncommited part') would 'disappear'.
Unfortunately the condition to reproduce that problem eluded us...
While reviewing the EasyHack list, I noticed one about the pre-commit
hook... I took a look and realized that
the hook was actually trying to 'fix' things on the fly... That is a
very scary proposition... what if something goes wrong ?
(the code that try to do the fixing is far from trivial, involving git
stash and temp-files dance...)
which reminded me of Tor's bug.
Sure enough: do 2 changes in a file, in 2 separate hunk. in one of
these change add trailing spaces... then commit only that hunk -> the
second hunk 'disappear'
So, since I do think that even trying to silently overrule the dev by
changing his commit on the fly is a Bad Thing(tm), I did not even try
to make that magic work in the case of partial commit... instead I
replaced the code by a pure detection, that yell at you when you try
to commit
trailing spaces (but is nice enough to tell you where they are)
This is now pushed on bootstrap... (the other gits share the hook of bootstrap)
Norbert
PS: I have not clean-up the entire hook... there is still some love
that can be dispensed there; like: do we really need to spend time to
grep for old 'Sun' license to warn about them ?
Context
- [Libreoffice] automagic 'fix' in pre-commit hook considered harmful · Norbert Thiebaud
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.