checkpatch: add fix option for GERRIT_CHANGE_ID

Currently, whenever a Gerrit Change-Id is present in a commit,
checkpatch.pl warns to remove the Change-Id before submitting the patch.

E.g., running checkpatch on commit adc311a5bb ("iwlwifi: bump FW
API to 53 for 22000 series") reports this error:

  ERROR: Remove Gerrit Change-Id's before submitting upstream
  Change-Id: I5725e46394f3f53c3069723fd513cc53c7df383d

Provide a simple fix option by simply deleting the indicated line.

Link: https://lkml.kernel.org/r/20201030114447.24199-1-yashsri421@gmail.com
Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
Acked-by: Joe Perches <joe@perches.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Aditya Srivastava 2020-12-15 20:44:47 -08:00 committed by Linus Torvalds
parent 339f29d91a
commit 7580c5b9b4
1 changed files with 5 additions and 2 deletions

View File

@ -2852,8 +2852,11 @@ sub process {
# Check for Gerrit Change-Ids not in any patch context
if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
ERROR("GERRIT_CHANGE_ID",
"Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr);
if (ERROR("GERRIT_CHANGE_ID",
"Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
$fix) {
fix_delete_line($fixlinenr, $rawline);
}
}
# Check if the commit log is in a possible stack dump