]>
Commit | Line | Data |
---|---|---|
853916ff LT |
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 | ## | |
c5f7674a LT |
7 | ## Update: Ryan Anderson finally shamed me into naming this "applymbox". |
8 | ## | |
853916ff LT |
9 | ## You give it a mbox-format collection of emails, and it will try to |
10 | ## apply them to the kernel using "applypatch" | |
11 | ## | |
37275318 | 12 | ## applymbox [ -c .dotest/msg-number ] [ -q ] mail_archive [Signoff_file]" |
ad4e9ce4 | 13 | ## |
37275318 JH |
14 | ## The patch application may fail in the middle. In which case: |
15 | ## (1) look at .dotest/patch and fix it up to apply | |
16 | ## (2) re-run applymbox with -c .dotest/msg-number for the current one. | |
17 | ## Pay a special attention to the commit log message if you do this and | |
18 | ## use a Signoff_file, because applypatch wants to append the sign-off | |
19 | ## message to msg-clean every time it is run. | |
ad4e9ce4 | 20 | |
37275318 JH |
21 | query_apply= continue= resume=t |
22 | while case "$#" in 0) break ;; esac | |
23 | do | |
24 | case "$1" in | |
25 | -q) query_apply=t ;; | |
26 | -c) continue="$2"; resume=f; shift ;; | |
27 | -*) usage ;; | |
28 | *) break ;; | |
29 | esac | |
30 | shift | |
31 | done | |
32 | ||
33 | case "$continue" in | |
34 | '') | |
35 | rm -rf .dotest | |
36 | mkdir .dotest | |
154d3d2d | 37 | git-mailsplit "$1" .dotest || exit 1 |
ad4e9ce4 | 38 | esac |
37275318 JH |
39 | |
40 | case "$query_apply" in | |
41 | t) touch .dotest/.query_apply | |
42 | esac | |
43 | ||
44 | for i in .dotest/0* | |
853916ff | 45 | do |
37275318 JH |
46 | case "$resume,$continue" in |
47 | f,$i) resume=t;; | |
48 | f,*) continue;; | |
49 | *) | |
154d3d2d | 50 | git-mailinfo .dotest/msg .dotest/patch <$i >.dotest/info || exit 1 |
37275318 JH |
51 | git-stripspace < .dotest/msg > .dotest/msg-clean |
52 | ;; | |
53 | esac | |
154d3d2d | 54 | git-applypatch .dotest/msg-clean .dotest/patch .dotest/info "$2" |
ad4e9ce4 JB |
55 | ret=$? |
56 | if [ $ret -ne 0 ]; then | |
57 | # 2 is a special exit code from applypatch to indicate that | |
58 | # the patch wasn't applied, but continue anyway | |
59 | [ $ret -ne 2 ] && exit $ret | |
60 | fi | |
853916ff | 61 | done |
ad4e9ce4 JB |
62 | # return to pristine |
63 | rm -fr .dotest |