linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: Add check for Change-Id
@ 2014-03-19 18:54 Christopher Covington
  2014-03-20 10:08 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Covington @ 2014-03-19 18:54 UTC (permalink / raw)
  To: linux-arm-kernel

A commit hook for the Gerrit code review server inserts change
identifiers so Gerrit can track patches through multiple revisions.
These identifiers are noise in the context of the upstream kernel.
(Many Gerrit servers are private. Even given a public instance,
given only a Change-Id, one must guess which server a change was
tracked on. Patches submitted to the Linux kernel mailing lists
should be able to stand on their own. If it's truly useful to
reference code review on a Gerrit server, a URL is a much clearer
way to do so.) Thus, issue an error when a Change-Id: line is
encountered.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 464dcef..afd6dde 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1891,6 +1891,12 @@ sub process {
 			}
 		}
 
+# Check for unwanted Gerrit info
+		if ($line =~ /^\s*change-id:/i) {
+			ERROR("BAD_SIGN_OFF",
+			      "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr);
+		}
+
 # Check for wrappage within a valid hunk of the file
 		if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
 			ERROR("CORRUPTED_PATCH",
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] checkpatch.pl: Add check for Change-Id
  2014-03-19 18:54 [PATCH] checkpatch.pl: Add check for Change-Id Christopher Covington
@ 2014-03-20 10:08 ` Joe Perches
  2014-03-21 17:24   ` Christopher Covington
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2014-03-20 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2014-03-19 at 14:54 -0400, Christopher Covington wrote:
> A commit hook for the Gerrit code review server inserts change
> identifiers so Gerrit can track patches through multiple revisions.
> These identifiers are noise in the context of the upstream kernel.
> (Many Gerrit servers are private. Even given a public instance,
> given only a Change-Id, one must guess which server a change was
> tracked on. Patches submitted to the Linux kernel mailing lists
> should be able to stand on their own. If it's truly useful to
> reference code review on a Gerrit server, a URL is a much clearer
> way to do so.) Thus, issue an error when a Change-Id: line is
> encountered.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -1891,6 +1891,12 @@ sub process {
>  			}
>  		}
>  
> +# Check for unwanted Gerrit info
> +		if ($line =~ /^\s*change-id:/i) {
> +			ERROR("BAD_SIGN_OFF",
> +			      "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr);
> +		}
> +

I think this needs an "$in_commit_log" test added

		if ($in_commit_log &&
		    $line =~ /^\s*change-id:/i) {

And maybe use a separate "TYPE", not "BAD_SIGN_OFF".
Maybe "GERRIT_CHANGE_ID"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] checkpatch.pl: Add check for Change-Id
  2014-03-20 10:08 ` Joe Perches
@ 2014-03-21 17:24   ` Christopher Covington
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Covington @ 2014-03-21 17:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Joe,

On 03/20/2014 06:08 AM, Joe Perches wrote:
> On Wed, 2014-03-19 at 14:54 -0400, Christopher Covington wrote:
>> A commit hook for the Gerrit code review server inserts change
>> identifiers so Gerrit can track patches through multiple revisions.
>> These identifiers are noise in the context of the upstream kernel.
>> (Many Gerrit servers are private. Even given a public instance,
>> given only a Change-Id, one must guess which server a change was
>> tracked on. Patches submitted to the Linux kernel mailing lists
>> should be able to stand on their own. If it's truly useful to
>> reference code review on a Gerrit server, a URL is a much clearer
>> way to do so.) Thus, issue an error when a Change-Id: line is
>> encountered.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -1891,6 +1891,12 @@ sub process {
>>  			}
>>  		}
>>  
>> +# Check for unwanted Gerrit info
>> +		if ($line =~ /^\s*change-id:/i) {
>> +			ERROR("BAD_SIGN_OFF",
>> +			      "Remove Gerrit Change-Id's before submitting upstream.\n" . $herecurr);
>> +		}
>> +
> 
> I think this needs an "$in_commit_log" test added
> 
> 		if ($in_commit_log &&
> 		    $line =~ /^\s*change-id:/i) {

This would mean that Change-Id lines that follow a Signed-off-by line will not
get caught. I expect that the common case is to use the commit hook shipped
with Gerrit [1], which inserts the Change-Id above the Signed-off-by, so the
proposed change is fine by me.

1.
https://gerrit.googlesource.com/gerrit/+/master/gerrit-server/src/main/resources/com/google/gerrit/server/tools/root/hooks/commit-msg

> And maybe use a separate "TYPE", not "BAD_SIGN_OFF".
> Maybe "GERRIT_CHANGE_ID"
> 

Will do.

Thanks,
Christopher

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-21 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-19 18:54 [PATCH] checkpatch.pl: Add check for Change-Id Christopher Covington
2014-03-20 10:08 ` Joe Perches
2014-03-21 17:24   ` Christopher Covington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).