Hi,
git commit takes a --verbose option, defined as follows:
-v, --verbose
Show unified diff between the HEAD commit and what would be committed at the
bottom of the commit message template. Note that this diff output doesn’t
have its lines prefixed with #.
It's very useful for making sure you're committing the right thing.
Unfortunately, it seems that the diff output isn't stripped before the
commit message is fed to the commit-msg hook.
I was committing a change to a README file, and the diff context
contained the line " * for the cppunittest needed:" (followed by a line
beginning with a "+" marking an added line). So, commit-msg saw a line
which starts with whitespace, followed by a star, with a colon in it and
rejected my commit message:
Reason: Please don't use whitespace in front of '* file: Description.' entries.
I don't know whether it's possible to tweak something so that the hook
receives the message without the unified diff; otherwise, perhaps the
hook should stop reading lines past something which looks like a unified
diff header.
Regards,
--
Will
Context
- commit-msg hook mistakes commit -v unified diff for part of the message · Will Thompson
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.