Skip to content

Commit

Permalink
checkpatch: exclude gerrit's Change-Id line from commit description
Browse files Browse the repository at this point in the history
Checkpatch rejects patches that have empty commit description and
logs them with:
	WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one
But if the patch has a gerrit's Change-Id line placed before the
line Signed-off-by, then checkpatch considers the Change-Id line
as a valid commit description text.

Use the Change-Id tag as a marker of the end of the commit message,
thus not counting its line as part of the commit description.

This patch is not relevant for the Linux kernel development process
as gerrit is not involved and the Change-Id tag is rejected. But
other projects, like OpenOCD, base the development on gerrit and
reuse kernel's checkpatch with flag '--ignore GERRIT_CHANGE_ID'.

This patch has been refused [1] in Linux upstream because it has
not been considered relevant for that project.
Let's take it as another add-on in OpenOCD checkpatch.

Change-Id: I3b55b8fffa07ce67177c108e7c9554ca46674246
Signed-off-by: Antonio Borneo <[email protected]>
Link: [1] https://lore.kernel.org/lkml/[email protected]/
Reviewed-on: https://review.openocd.org/c/openocd/+/8539
Tested-by: jenkins
  • Loading branch information
borneoa committed Nov 16, 2024
1 parent 6d60ac5 commit 8a37230
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3251,6 +3251,9 @@ sub process {

# Check for Gerrit Change-Ids not in any patch context
if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
# OpenOCD specific: Begin: exclude gerrit's Change-Id line from commit description
$in_commit_log = 0;
# OpenOCD specific: End
if (ERROR("GERRIT_CHANGE_ID",
"Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
$fix) {
Expand Down

0 comments on commit 8a37230

Please sign in to comment.