mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: Fix cleanpatch to always replace leading space with tab
@ 2014-10-10 23:20 Andi Kleen
  0 siblings, 0 replies; only message in thread
From: Andi Kleen @ 2014-10-10 23:20 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kernel, linux-kbuild, Andi Kleen, hpa

From: Andi Kleen <ak@linux.intel.com>

If you have something like

<sp><sp><sp><sp><sp><sp><sp><sp>blabla

in a patch cleanpatch does not replace the spaces with tabs.
That is because it only handles space in front of tab.

But it's more convenient if it also replaces space with tabs,
even if there is no tab at all, as that is what checkpatch
and other pedants expect.

Cc: hpa@zytor.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/cleanpatch | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/cleanpatch b/scripts/cleanpatch
index 9680d03..d14aac9 100755
--- a/scripts/cleanpatch
+++ b/scripts/cleanpatch
@@ -39,6 +39,10 @@ sub clean_space_tabs($)
 	} elsif ($c eq " ") {
 	    $nsp++;
 	} else {
+	    while ($nsp >= 8) {
+	        $lo .= "\t";
+		$nsp -= 8;
+	    }
 	    $lo .= " " x $nsp;
 	    $pos += $nsp;
 	    $nsp = 0;
-- 
1.9.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-10 23:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-10 23:20 [PATCH] kbuild: Fix cleanpatch to always replace leading space with tab Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®