Skip to content

fix: Signed-off-by trailer not being added to verbose commits#233

Merged
aadam-ali merged 1 commit into
mainfrom
fix-missing-trailer-on-verbose-commits
Jul 20, 2026
Merged

fix: Signed-off-by trailer not being added to verbose commits#233
aadam-ali merged 1 commit into
mainfrom
fix-missing-trailer-on-verbose-commits

Conversation

@aadam-ali

@aadam-ali aadam-ali commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

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 change 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.

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-msg events allows additional logic to validate that the security scan pre-commit hook exists, conditionally adding the Signed-off-by trailer if so.

Contributors

@aadam-ali

Type of change

  • Refactoring (made code better without changing its behaviour)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

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

  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Reviewer Checklist

  • I have reviewed the PR and ensured no secret values are present

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
@aadam-ali
aadam-ali requested a review from a team as a code owner July 17, 2026 16:11
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or OpenSSF Scorecard issues found.

Scanned Files

None

@sumau sumau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :-)

@aadam-ali

Copy link
Copy Markdown
Contributor Author

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 :-)

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.

@aadam-ali
aadam-ali merged commit f8c17fc into main Jul 20, 2026
19 checks passed
@aadam-ali
aadam-ali deleted the fix-missing-trailer-on-verbose-commits branch July 20, 2026 11:52
@aadam-ali aadam-ali mentioned this pull request Jul 20, 2026
9 tasks
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants