mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: mmarek@suse.cz
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>,
	hpa@zytor.com
Subject: [PATCH] kbuild: Fix cleanpatch to always replace leading space with tab
Date: Fri, 10 Oct 2014 16:20:46 -0700	[thread overview]
Message-ID: <1412983246-12118-1-git-send-email-andi@firstfloor.org> (raw)

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


                 reply	other threads:[~2014-10-10 23:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412983246-12118-1-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®