Add "stripspace" program to clean up email commentary
[git.git] / dotest
1 #!/bin/sh
2 ##
3 ## "dotest" is my stupid name for my patch-application script, which
4 ## I never got around to renaming after I tested it. We're now on the
5 ## second generation of scripts, still called "dotest".
6 ##
7 ## You give it a mbox-format collection of emails, and it will try to
8 ## apply them to the kernel using "applypatch"
9 ##
10 ## dotest [ -q ] mail_archive [Signoff_file]
11 ##
12 rm -rf .dotest
13 mkdir .dotest
14 case $1 in
15
16         -q)     touch .dotest/.query_apply
17                 shift;;
18 esac
19 mailsplit $1 .dotest || exit 1
20 for i in .dotest/*
21 do
22         mailinfo .dotest/msg .dotest/patch .dotest/file < $i > .dotest/info || exit 1
23         stripspace < .dotest/msg > .dotest/msg-clean
24         applypatch .dotest/msg-clean .dotest/patch .dotest/file .dotest/info "$2"
25         ret=$?
26         if [ $ret -ne 0 ]; then
27                 # 2 is a special exit code from applypatch to indicate that
28                 # the patch wasn't applied, but continue anyway 
29                 [ $ret -ne 2 ] && exit $ret
30         fi
31 done
32 # return to pristine
33 rm -fr .dotest