checkpatch: Don't emit unified-diff error for rename-only patches
PATCH 1/1 checkpatch: Don't emit unified-diff error for rename-only patches
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 | 0ERROR: 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 <[email protected]>
Date: Fri, 2 Dec 2016 12:26:21 +1030
Subject: [PATCH 6/6] mfd: dt: Move syscon bindings to syscon subdirectoryThe use of syscons is growing, lets collate them in their own part of the bindings tree.
---
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.
--- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
@@ -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);
Signature · 1 line
2.9.3
Quoted 93 lines · Andrew Jeffery
I generated a patch with
git format-patchwhich 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 | 0ERROR: 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.patchhas style problems, please review.NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.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 <[email protected]> Date: Fri, 2 Dec 2016 12:26:21 +1030 Subject: [PATCH 6/6] mfd: dt: Move syscon bindings to syscon subdirectoryThe use of syscons is growing, lets collate them in their own part of the bindings tree.
Signed-off-by Andrew Jeffery <[email protected]>---
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(-)
renameDocumentation/devicetree/bindings/mfd/{=>syscon}/aspeed-scu.txt(100%) renameDocumentation/devicetree/bindings/mfd/{=>syscon}/atmel-gpbr.txt(100%) renameDocumentation/devicetree/bindings/mfd/{=>syscon}/atmel-matrix.txt(100%) renameDocumentation/devicetree/bindings/mfd/{=>syscon}/atmel-smc.txt(100%) renameDocumentation/devicetree/bindings/mfd/{=>syscon}/qcom,tcsr.txt(100%) renameDocumentation/devicetree/bindings/mfd/{=>syscon}/syscon.txt(100%) renameDocumentation/devicetree/bindings/mfd/{=>syscon}/ti-keystone-devctrl.txt(100%)diff --git
a/Documentation/devicetree/bindings/mfd/aspeed-scu.txtb/Documentation/devicetree/bindings/mfd/syscon/aspeed-scu.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/aspeed-scu.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/aspeed-scu.txt
diff --gita/Documentation/devicetree/bindings/mfd/atmel-gpbr.txtb/Documentation/devicetree/bindings/mfd/syscon/atmel-gpbr.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/atmel-gpbr.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/atmel-gpbr.txt
diff --gita/Documentation/devicetree/bindings/mfd/atmel-matrix.txtb/Documentation/devicetree/bindings/mfd/syscon/atmel-matrix.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/atmel-matrix.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/atmel-matrix.txt
diff --gita/Documentation/devicetree/bindings/mfd/atmel-smc.txtb/Documentation/devicetree/bindings/mfd/syscon/atmel-smc.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/atmel-smc.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/atmel-smc.txt
diff --gita/Documentation/devicetree/bindings/mfd/qcom,tcsr.txtb/Documentation/devicetree/bindings/mfd/syscon/qcom,tcsr.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/qcom,tcsr.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/qcom,tcsr.txt
diff --gita/Documentation/devicetree/bindings/mfd/syscon.txtb/Documentation/devicetree/bindings/mfd/syscon/syscon.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/syscon.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/syscon.txt
diff --gita/Documentation/devicetree/bindings/mfd/ti-keystone-devctrl.txtb/Documentation/devicetree/bindings/mfd/syscon/ti-keystone-devctrl.txtsimilarity index 100%
rename fromDocumentation/devicetree/bindings/mfd/ti-keystone-devctrl.txt
rename toDocumentation/devicetree/bindings/mfd/syscon/ti-keystone-devctrl.txt
--
2.9.3Set '$is_patch = 1;' in the add/remove/rename detection to avoid generating spurious warnings.
Signed-off-by Andrew Jeffery <[email protected]>--- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+)scripts/checkpatch.pl +0
-0
scripts/checkpatch.pl sub process { · line 2595
Quoted 7 lines
scripts/checkpatch.pl +1
-0@@ -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.