Received: from eggs.gnu.org ([2001:4830:134:3::10]:36222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4qR-0003Yx-8h for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bP4qP-0006Wh-B6 for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:28:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bP4qP-0006Wd-5P for qemu-devel@nongnu.org; Mon, 18 Jul 2016 05:28:09 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 743C77F7BA for ; Mon, 18 Jul 2016 09:28:08 +0000 (UTC) From: Paolo Bonzini Date: Mon, 18 Jul 2016 11:27:38 +0200 Message-Id: <1468834075-25669-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1468834075-25669-1-git-send-email-pbonzini@redhat.com> References: <1468834075-25669-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 06/23] checkpatch: consider git extended headers valid patches List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi From: 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 Signed-off-by: Stefan Hajnoczi Message-Id: <1468576014-28788-1-git-send-email-stefanha@redhat.com> Signed-off-by: Paolo Bonzini --- 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