All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches
@ 2016-07-15  9:46 Stefan Hajnoczi
  2016-07-15 17:52 ` Eric Blake
  2016-07-18 12:15 ` Stefan Hajnoczi
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2016-07-15  9:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Colin Lord, Stefan Hajnoczi

Renames look like this with git-diff(1) when diff.renames = true is set:

  diff --git a/a b/b
  similarity index 100%
  rename from a
  rename to b

This raises the "Does not appear to be a unified-diff format patch"
error because checkpatch.pl only considers a diff valid if it contains
at least one "@@" hunk.

This patch accepts renames and copies too so that checkpatch.pl exits
successfully when a diff only renames/copies files.  The git diff
extended header format is described on the git-diff(1) man page.

Reported-by: Colin Lord <clord@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 scripts/checkpatch.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cf32c8f..afa7f79 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1279,6 +1279,11 @@ sub process {
 			}
 		}
 
+# Accept git diff extended headers as valid patches
+		if ($line =~ /^(?:rename|copy) (?:from|to) [\w\/\.\-]+\s*$/) {
+			$is_patch = 1;
+		}
+
 #check the patch for a signoff:
 		if ($line =~ /^\s*signed-off-by:/i) {
 			# This is a signoff, if ugly, so do not double report.
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches
  2016-07-15  9:46 [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches Stefan Hajnoczi
@ 2016-07-15 17:52 ` Eric Blake
  2016-07-18 12:15 ` Stefan Hajnoczi
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2016-07-15 17:52 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel; +Cc: Colin Lord

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

On 07/15/2016 03:46 AM, Stefan Hajnoczi wrote:
> Renames look like this with git-diff(1) when diff.renames = true is set:
> 
>   diff --git a/a b/b
>   similarity index 100%
>   rename from a
>   rename to b
> 
> This raises the "Does not appear to be a unified-diff format patch"
> error because checkpatch.pl only considers a diff valid if it contains
> at least one "@@" hunk.
> 
> This patch accepts renames and copies too so that checkpatch.pl exits
> successfully when a diff only renames/copies files.  The git diff
> extended header format is described on the git-diff(1) man page.
> 
> Reported-by: Colin Lord <clord@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  scripts/checkpatch.pl | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Eric Blake <eblake@redhat.com>

and especially nice since we recommend diff.renames = true in our patch
submission guidelines.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches
  2016-07-15  9:46 [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches Stefan Hajnoczi
  2016-07-15 17:52 ` Eric Blake
@ 2016-07-18 12:15 ` Stefan Hajnoczi
  2016-07-18 13:15   ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2016-07-18 12:15 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, Colin Lord

[-- Attachment #1: Type: text/plain, Size: 954 bytes --]

On Fri, Jul 15, 2016 at 10:46:54AM +0100, Stefan Hajnoczi wrote:
> Renames look like this with git-diff(1) when diff.renames = true is set:
> 
>   diff --git a/a b/b
>   similarity index 100%
>   rename from a
>   rename to b
> 
> This raises the "Does not appear to be a unified-diff format patch"
> error because checkpatch.pl only considers a diff valid if it contains
> at least one "@@" hunk.
> 
> This patch accepts renames and copies too so that checkpatch.pl exits
> successfully when a diff only renames/copies files.  The git diff
> extended header format is described on the git-diff(1) man page.
> 
> Reported-by: Colin Lord <clord@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  scripts/checkpatch.pl | 5 +++++
>  1 file changed, 5 insertions(+)

There is no maintainer for checkpatch.pl, so...

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches
  2016-07-18 12:15 ` Stefan Hajnoczi
@ 2016-07-18 13:15   ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2016-07-18 13:15 UTC (permalink / raw)
  To: Stefan Hajnoczi, Stefan Hajnoczi; +Cc: qemu-devel, Colin Lord



On 18/07/2016 14:15, Stefan Hajnoczi wrote:
> On Fri, Jul 15, 2016 at 10:46:54AM +0100, Stefan Hajnoczi wrote:
>> Renames look like this with git-diff(1) when diff.renames = true is set:
>>
>>   diff --git a/a b/b
>>   similarity index 100%
>>   rename from a
>>   rename to b
>>
>> This raises the "Does not appear to be a unified-diff format patch"
>> error because checkpatch.pl only considers a diff valid if it contains
>> at least one "@@" hunk.
>>
>> This patch accepts renames and copies too so that checkpatch.pl exits
>> successfully when a diff only renames/copies files.  The git diff
>> extended header format is described on the git-diff(1) man page.
>>
>> Reported-by: Colin Lord <clord@redhat.com>
>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>> ---
>>  scripts/checkpatch.pl | 5 +++++
>>  1 file changed, 5 insertions(+)
> 
> There is no maintainer for checkpatch.pl, so...
> 
> Thanks, applied to my block tree:
> https://github.com/stefanha/qemu/commits/block

Actually I've sent a pull request for this patch too this morning
(forgot to sent the "applied" message because at the time I applied it I
was offline), but Peter bumped it.

Paolo

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

end of thread, other threads:[~2016-07-18 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-15  9:46 [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches Stefan Hajnoczi
2016-07-15 17:52 ` Eric Blake
2016-07-18 12:15 ` Stefan Hajnoczi
2016-07-18 13:15   ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.