lkml.org 
[lkml]   [2007]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[SCRIPT] Remove "space damage" from patches
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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-01-28 22:39    [W:0.171 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site