Re: [PATCH] checkpatch: Don't emit unified-diff error for rename-only patches

From: Joe Perches
Date: Mon Dec 05 2016 - 18:52:46 EST


On Tue, 2016-12-06 at 10:22 +1100, Andrew Jeffery wrote:
> I generated a patch with `git format-patch` which checkpatch thinks is
> invalid:
>
> $ ./scripts/checkpatch.pl lpc-dt/0006-mfd-dt-Move-syscon-bindings-to-syscon-subdirectory.patch
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> Documentation/devicetree/bindings/mfd/{ => syscon}/aspeed-scu.txt | 0
>
> ERROR: Does not appear to be a unified-diff format patch
>
> total: 1 errors, 1 warnings, 0 lines checked
>
> NOTE: For some of the reported defects, checkpatch may be able to
> mechanically convert to the typical style using --fix or --fix-inplace.
>
> lpc-dt/0006-mfd-dt-Move-syscon-bindings-to-syscon-subdirectory.patch has style problems, please review.
>
> NOTE: If any of the errors are false positives, please report
> them to the maintainer, see CHECKPATCH in MAINTAINERS.
>
> The patch in question was all renames with no edits, giving 100% similarity and
> thus no diff markers.
>
> $ cat lpc-dt/0006-mfd-dt-Move-syscon-bindings-to-syscon-subdirectory.patch
> From 325409d9ceca0aa8371dd1f7c7cf4e4b8a92487e Mon Sep 17 00:00:00 2001
> From: Andrew Jeffery <andrew@xxxxxxxx>
> Date: Fri, 2 Dec 2016 12:26:21 +1030
> Subject: [PATCH 6/6] mfd: dt: Move syscon bindings to syscon subdirectory
>
> The use of syscons is growing, lets collate them in their own part of
> the bindings tree.
>
> Signed-off-by: Andrew Jeffery <andrew@xxxxxxxx>
> ---
> Documentation/devicetree/bindings/mfd/{ => syscon}/aspeed-scu.txt | 0
> Documentation/devicetree/bindings/mfd/{ => syscon}/atmel-gpbr.txt | 0
> Documentation/devicetree/bindings/mfd/{ => syscon}/atmel-matrix.txt | 0
> Documentation/devicetree/bindings/mfd/{ => syscon}/atmel-smc.txt | 0
> Documentation/devicetree/bindings/mfd/{ => syscon}/qcom,tcsr.txt | 0
> Documentation/devicetree/bindings/mfd/{ => syscon}/syscon.txt | 0
> .../devicetree/bindings/mfd/{ => syscon}/ti-keystone-devctrl.txt | 0
> 7 files changed, 0 insertions(+), 0 deletions(-)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/aspeed-scu.txt (100%)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/atmel-gpbr.txt (100%)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/atmel-matrix.txt (100%)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/atmel-smc.txt (100%)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/qcom,tcsr.txt (100%)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/syscon.txt (100%)
> rename Documentation/devicetree/bindings/mfd/{ => syscon}/ti-keystone-devctrl.txt (100%)
>
> diff --git a/Documentation/devicetree/bindings/mfd/aspeed-scu.txt b/Documentation/devicetree/bindings/mfd/syscon/aspeed-scu.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/aspeed-scu.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/aspeed-scu.txt
> diff --git a/Documentation/devicetree/bindings/mfd/atmel-gpbr.txt b/Documentation/devicetree/bindings/mfd/syscon/atmel-gpbr.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/atmel-gpbr.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/atmel-gpbr.txt
> diff --git a/Documentation/devicetree/bindings/mfd/atmel-matrix.txt b/Documentation/devicetree/bindings/mfd/syscon/atmel-matrix.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/atmel-matrix.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/atmel-matrix.txt
> diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt b/Documentation/devicetree/bindings/mfd/syscon/atmel-smc.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/atmel-smc.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/atmel-smc.txt
> diff --git a/Documentation/devicetree/bindings/mfd/qcom,tcsr.txt b/Documentation/devicetree/bindings/mfd/syscon/qcom,tcsr.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/qcom,tcsr.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/qcom,tcsr.txt
> diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon/syscon.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/syscon.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/syscon.txt
> diff --git a/Documentation/devicetree/bindings/mfd/ti-keystone-devctrl.txt b/Documentation/devicetree/bindings/mfd/syscon/ti-keystone-devctrl.txt
> similarity index 100%
> rename from Documentation/devicetree/bindings/mfd/ti-keystone-devctrl.txt
> rename to Documentation/devicetree/bindings/mfd/syscon/ti-keystone-devctrl.txt
> --
> 2.9.3
>
> Set '$is_patch = 1;' in the add/remove/rename detection to avoid
> generating spurious warnings.
>
> Signed-off-by: Andrew Jeffery <andrew@xxxxxxxx>
> ---
> scripts/checkpatch.pl | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index a8368d1c4348..9a434eb4aac4 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2589,6 +2589,7 @@ sub process {
> $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
> ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
> (defined($1) || defined($2))))) {
> + $is_patch = 1;
> $reported_maintainer_file = 1;
> WARN("FILE_PATH_CHANGES",
> "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);

Seems sensible, thanks.

Acked-by: Joe Perches <joe@xxxxxxxxxxx>