Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting commits from log fails when git option log.showSignature is enabled #2118

Closed
2 of 4 tasks
thesmiley1 opened this issue Sep 10, 2020 · 2 comments · Fixed by conventional-changelog/conventional-changelog#671
Labels

Comments

@thesmiley1
Copy link

When linting commits sourced from git log, commitlint fails to parse/analyze commits correctly if git's log.showSignature option is enabled, either for the repository or globally.

Expected Behavior

Commitlint should gracefully handle this configuration and parse/analyze the commits correctly.

Current Behavior

Commitlint chokes on parsing signatures and fails to analyze commits correctly.

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Git log needs to be called with the --no-show-signature to normalize output (no signature) regardless of configuration.

Alternatively, parsers would need to be modified to gracefully handle signatures somehow, whether it's full parsing or just recognizing and skipping them. It still might be useful to normalize output (maybe always showing signatures in this case). Parsing signatures is briefly mentioned in #321.

The first option is much simpler for squashing this bug and the second is more of a larger feature addition.

Steps to Reproduce (for bugs)

There are signed commits in this repo that can be used to reproduce this issue, e.g. b610bcd.

  1. git clone 'https://github.com/conventional-changelog/commitlint.git'
  2. cd commitlint
  3. git config log.showSignature true
  4. commitlint --from b610bcd15215cc5f14fb6de07914ed595cc3047b~1 --to b610bcd15215cc5f14fb6de07914ed595cc3047b

Context

I like to have signatures shown when I run git log as it makes it very obvious which commits are signed and which are not. So, I have this enabled globally: git config --global log.showSignature true. This bug effectively prevents me from using commitlint with my preferred git configuration.

Your Environment

Executable Version
commitlint --version @commitlint/[email protected]
git --version git version 2.28.0
node --version v14.9.0

See also

There is a similar bug report (but lacking details) that I believe is the same issue in conventional-changelog/conventional-changelog#213.

thesmiley1 added a commit to thesmiley1/conventional-changelog that referenced this issue Sep 10, 2020
This disables `git log` showing signatures (`--no-show-signature`)
unless `showSignature` is set to a truthy value.  This way differences
in developers` local configuration (`log.showSignature`) do not affect
tooling operation.  Callers of `gitRawCommits` will need to explicitly
request signatures (via `rawGitOpts`) if they are desired, instead of
the current behavior of the presence of signatures being undefined.

Fixes conventional-changelog/commitlint#2118
@escapedcat
Copy link
Member

Hey @thesmiley1 , thanks you for this really well written issue! :)
Your possible solution sounds good to me.
We try to tackle this next time when we find some time to work on commitlint. If you are not too busy you can also give it a try but only if you feel like it.

@escapedcat escapedcat added the bug label Sep 11, 2020
@thesmiley1
Copy link
Author

thesmiley1 commented Sep 11, 2020

Thanks. While tracing through code, I thought the best location for a fix might be the git-raw-commits package, to shore up what is effectively undefined behavior. So I opened a PR at conventional-changelog/conventional-changelog#671. Feedback on that decision (patch location) and testing advice are welcome. :)

bcoe added a commit to conventional-changelog/conventional-changelog that referenced this issue Dec 29, 2020
This disables `git log` showing signatures (`--no-show-signature`)
unless `showSignature` is set to a truthy value.  This way differences
in developers` local configuration (`log.showSignature`) do not affect
tooling operation.  Callers of `gitRawCommits` will need to explicitly
request signatures (via `rawGitOpts`) if they are desired, instead of
the current behavior of the presence of signatures being undefined.

Fixes conventional-changelog/commitlint#2118

Co-authored-by: Benjamin E. Coe <[email protected]>
AlexGuz23 pushed a commit to AlexGuz23/conventional-changelog that referenced this issue Nov 3, 2022
This disables `git log` showing signatures (`--no-show-signature`)
unless `showSignature` is set to a truthy value.  This way differences
in developers` local configuration (`log.showSignature`) do not affect
tooling operation.  Callers of `gitRawCommits` will need to explicitly
request signatures (via `rawGitOpts`) if they are desired, instead of
the current behavior of the presence of signatures being undefined.

Fixes conventional-changelog/commitlint#2118

Co-authored-by: Benjamin E. Coe <[email protected]>
AlerqiKeskin added a commit to AlerqiKeskin/conventional-changelog that referenced this issue Feb 27, 2023
This disables `git log` showing signatures (`--no-show-signature`)
unless `showSignature` is set to a truthy value.  This way differences
in developers` local configuration (`log.showSignature`) do not affect
tooling operation.  Callers of `gitRawCommits` will need to explicitly
request signatures (via `rawGitOpts`) if they are desired, instead of
the current behavior of the presence of signatures being undefined.

Fixes conventional-changelog/commitlint#2118

Co-authored-by: Benjamin E. Coe <[email protected]>
Serhii524 pushed a commit to Serhii524/h_conventional that referenced this issue Dec 28, 2024
This disables `git log` showing signatures (`--no-show-signature`)
unless `showSignature` is set to a truthy value.  This way differences
in developers` local configuration (`log.showSignature`) do not affect
tooling operation.  Callers of `gitRawCommits` will need to explicitly
request signatures (via `rawGitOpts`) if they are desired, instead of
the current behavior of the presence of signatures being undefined.

Fixes conventional-changelog/commitlint#2118

Co-authored-by: Benjamin E. Coe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants