False-positive body-leading-blank
warnings for GPG-signed commits.
#3003
Labels
body-leading-blank
warnings for GPG-signed commits.
#3003
This is a follow-up to #876.
The upshot is that I am getting
warnings for GPG-signed commits that actually do have leading blanks.
Furthermore, the very same commit messages do not trigger that warning when passed in from
STDIN
or when not GPG-signing the commits.My guess is that the original issue might have been 'resolved' when switching to the other computer by different Git default configurations on the two systems involved (the first one GPG-signing by default, the second one not).
Expected Behavior
When a message contains a blank line between header and body it should not trigger a
body-leading-blank
warning, regardless whether the corresponding commit was GPG signed or not.Current Behavior
When a message contains a blank line between header and body it does not trigger a
body-leading-blank
warning when passed in viaSTDIN
or queried from the Git log via a non-GPG-signed commit, but does so when queried from the Git log via a GPG-signed commit.Affected packages
Steps to Reproduce (for bugs)
Create test repository:
Write test commit message to a text file.
Create default commitlint config:
Ensure that commit message does not trigger a
body-leading-blank
warning when passed in viaSTDIN
:commitlint \ --config=commitlint.config.js \ < commit-message
Create non-GPG-signed commit using that exact same message:
git add . git commit \ --quiet \ --no-gpg-sign \ --file=commit-message
Ensure that commit message does not trigger a
body-leading-blank
warning when passed in via the non-GPG-signed commit:Create a temporary GnuPG home directory:
Generate a temporary GPG key:
Amend the commit to GPG-sign it without changing the commit message:
git commit \ --quiet \ --amend \ --gpg-sign='Test user <[email protected]>' \ --no-edit
Observe the false-positive
body-leading-blank
warning when queried from the Git log via the GPG-signed commit:commitlint.config.js
Context
See this blogpost by Mike Gerwitz for a nice writeup of why GPG-signing commits is a good idea.
If I have to decide between using commitlint or GPG-signing my commits, I'll choose the latter.
Your Environment
This is on Gentoo using Node.js and Git from Portage but commitlint installed via
npm install --global '@commitlint/cli'
Furthermore, the Conventional Commits configuration module was installed via
npm install --global '@commitlint/config-conventional'
For it to be found, I also had to add the following to my shell environment:
commitlint --version
@commitlint/[email protected]
git --version
git version 2.34.1
node --version
v14.17.6
The text was updated successfully, but these errors were encountered: