LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [SCRIPT] Remove "space damage" from patches
@ 2007-01-28 21:37 Richard Knutsson
  2007-01-28 22:52 ` Oleg Verych
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Knutsson @ 2007-01-28 21:37 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Hello Andrew and all

I recently tried "git-apply" on the 2.6.20-rc6-mm1 patch and found it to complain about white-spaces.
So as a mean to (hopefully) cut down on these nasty white-spaces (and sometimes tabs) I wrote this
little script. All it does is checking (lines that are going to be added) for spaces before tabs
and trailing spaces/tabs. I tried it on 2.6.20-rc6-mm1 and it seem to work well

If there is someone interested, _please_ take it. Any suggestion are welcomed :)

Richard Knutsson

--- 

#!/bin/sh

#./<script-name> <patch to check>

msg="Checking..."
echo $msg

while [ "$msg" ]; do \

  msg=""

  if grep -q -E "^\+	* +	" $1; then \
    msg="Found whitespace before tab"
    echo $msg
    sed --in-place -r "s/^\+(	*) {8}( *)	/\+\1	\2	/"	$1
    sed --in-place -r "s/^\+(	*) {1,7}	/\+\1	/"		$1
  fi

  if grep -q -E "^\+.*[	 ]$" $1; then \
    msg="Found trailing whitespace/tab"
    echo $msg
    sed --in-place -r "s/^\+(.*)([^ ])[	 ]+$/\+\1\2/"			$1
    sed --in-place -r "s/^\+[	 ]+$/\+/"				$1
  fi

  if [ "$msg" != "" ]; then \
    echo "Cleaning done, will make another run"
  fi
done



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-01-29  2:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-28 21:37 [SCRIPT] Remove "space damage" from patches Richard Knutsson
2007-01-28 22:52 ` Oleg Verych
2007-01-29  0:08   ` Richard Knutsson
2007-01-29  0:31     ` Oleg Verych
2007-01-29  1:26       ` Richard Knutsson
2007-01-29  1:43         ` Oleg Verych
2007-01-29  2:00           ` Richard Knutsson
2007-01-29  2:27             ` Oleg Verych

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).