Messages in this thread Patch in this message | | | Subject | Re: [RFC][PATCH] checkpatch: Properly warn if Change-Id comes after first Signed-off-by line | From | Joe Perches <> | Date | Mon, 24 Feb 2020 22:49:15 -0800 |
| |
On Mon, 2020-02-24 at 20:48 -0800, John Stultz wrote: > On Mon, Feb 24, 2020 at 6:13 PM Joe Perches <joe@perches.com> wrote: > > On Mon, 2020-02-24 at 23:58 +0000, John Stultz wrote: > > > Quite often, the Change-Id may be between Signed-off-by: lines or > > > at the end of them. Unfortunately checkpatch won't catch these > > > cases as it disables in_commit_log when it catches the first > > > Signed-off-by line. > > > > > > This has bitten me many many times. > > > > Hmm. When is change-id used in your workflow? > > Since I have a few kernel repos that I use for both upstream work and > work targeting AOSP trees, I usually have the gerrit commit hook > enabled in my tree (its easier to strip with sed then it is to re-add > after submitting to gerrit), and at least the commit-msg hook I have > will usually append a Change-Id: line at the end of the commit > message, usually after the signed-off-by line.
Perhaps this is better: --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a63380..698c7c8 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2721,9 +2721,9 @@ sub process { } # Check for unwanted Gerrit info - if ($in_commit_log && $line =~ /^\s*change-id:/i) { + if ($realfile eq '' && $line =~ /^\s*change-id:/i) { ERROR("GERRIT_CHANGE_ID", - "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr); + "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr); } # Check if the commit log is in a possible stack dump
| |