From patchwork Fri Jul 15 09:46:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 9231469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 31D2460574 for ; Fri, 15 Jul 2016 09:47:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FD4227CCB for ; Fri, 15 Jul 2016 09:47:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1400428324; Fri, 15 Jul 2016 09:47:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9530727FB7 for ; Fri, 15 Jul 2016 09:47:25 +0000 (UTC) Received: from localhost ([::1]:59510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNziO-0006GC-D0 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 15 Jul 2016 05:47:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNzi0-0006FT-NE for qemu-devel@nongnu.org; Fri, 15 Jul 2016 05:47:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNzhx-0005K6-HH for qemu-devel@nongnu.org; Fri, 15 Jul 2016 05:47:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46183) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNzhx-0005K2-Bx for qemu-devel@nongnu.org; Fri, 15 Jul 2016 05:46:57 -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 B1B4638102D for ; Fri, 15 Jul 2016 09:46:56 +0000 (UTC) Received: from localhost (ovpn-112-63.ams2.redhat.com [10.36.112.63]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6F9ktSj023676; Fri, 15 Jul 2016 05:46:56 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Fri, 15 Jul 2016 10:46:54 +0100 Message-Id: <1468576014-28788-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 15 Jul 2016 09:46:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] checkpatch: consider git extended headers valid patches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi , Colin Lord Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Eric Blake --- 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.