Closed gpanders closed 2 months ago
Thanks for the PR!
I also remember wanting to allow trailing whitespace because it looks like usually being removed. However, if commit was done as git commit --cleanup=verbatim
, the 'lintcommit.lua' script needs to detect that it still contains some improper lines.
So if there is a reliable and robust way to force commits to always be done with proper cleanup, I am all for this change. Otherwise I'll take time thinking about what is best here.
I've decided to make a more fundamental change and introduce the "strict" (line already done commits) vs "not strict" (editing commit) contexts. This also allowed to fix a slightly annoying issue of commit linting failing on git commit --amend
which adds trailing blank lines (and previously failed).
Thanks for pointing the issue!
When using
git commit --verbose
(or when the commit.verbose git config option is set), the diff of the commit is placed into the buffer when writing the commit message after a so-called "scissor line". This can cause the commit linter to fail because of long lines. However, anything below the "scissor line" is removed from the commit message by git (seehelp git commit
) so should not be validated by the commit linter.Quoting the text from the
git-commit
man page: