fix: Signed-off-by trailer not being added to verbose commits#233
Merged
Conversation
When using an editor to write commit messages with the `commit.verbose` config option set to `true`, the `Signed-off-by` trailer is not added to commits. With the config option set, the following warning is shown: > # ------------------------ >8 ------------------------ > # Do not modify or remove the line above. > # Everything below it will be ignored. The `commit-msg` hook appends the trailer to the end of the commit message file, meaning it's appended after this line therefore it's not actually added to the commit message. This commit filters out the contents of a commit message from the cut-off line ensuring that the `Signed-off-by` trailer is actually added to these commits. Signed-off-by: DBT pre-commit check
Dependency Review✅ No vulnerabilities or OpenSSF Scorecard issues found.Scanned FilesNone |
sumau
reviewed
Jul 20, 2026
sumau
left a comment
Contributor
There was a problem hiding this comment.
Thanks @aadam-ali ! Using # ------------------------ >8 ------------------------ feels very brittle, are you sure that's the best way to determine the end of the commit message? It could be just wanted to make sure :-)
Contributor
Author
I initially had the same concern, but having read the Git docs, this is documented https://git-scm.com/docs/git-commit#Documentation/git-commit.txt-scissors. |
sumau
approved these changes
Jul 20, 2026
aadam-ali
added a commit
that referenced
this pull request
Jul 21, 2026
Contains the fix from <#233> Signed-off-by: DBT pre-commit check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When using an editor to write commit messages with the
commit.verboseconfig option set totrue, theSigned-off-bytrailer is not added to commits.With the config option set, the following warning is shown:
The
commit-msghook appends the trailer to the end of the commit message file, meaning it's appended after this line therefore it's not actually added to the commit message.This change filters out the contents of a commit message from the cut-off line ensuring that the
Signed-off-bytrailer is actually added to these commits.Note, we are not using the builtin trailer functionality as this requires the trailers to be passed alongside the commit command. This hook running against
commit-msgevents allows additional logic to validate that the security scan pre-commit hook exists, conditionally adding theSigned-off-bytrailer if so.Contributors
@aadam-ali
Type of change
How this has been tested
Unit tests have been added, whilst ensuring the existing tests continue to pass.
This repository also runs the validate hook using the source code from the current branch. The trailer was successfully added when this ran.
Checklist
Reviewer Checklist