]>
Commit | Line | Data |
---|---|---|
46df82d5 MZ |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2010 Junio C Hamano. | |
4 | # | |
5 | ||
46df82d5 MZ |
6 | case "$action" in |
7 | continue) | |
c5e610be | 8 | git am --resolved --resolvemsg="$resolvemsg" && |
46df82d5 | 9 | move_to_original_branch |
a1549e10 | 10 | return |
46df82d5 MZ |
11 | ;; |
12 | skip) | |
c5e610be | 13 | git am --skip --resolvemsg="$resolvemsg" && |
46df82d5 | 14 | move_to_original_branch |
a1549e10 | 15 | return |
46df82d5 MZ |
16 | ;; |
17 | esac | |
18 | ||
19 | test -n "$rebase_root" && root_flag=--root | |
20 | ||
e481af06 | 21 | ret=0 |
90e1818f NH |
22 | if test -n "$keep_empty" |
23 | then | |
24 | # we have to do this the hard way. git format-patch completely squashes | |
25 | # empty commits and even if it didn't the format doesn't really lend | |
26 | # itself well to recording empty patches. fortunately, cherry-pick | |
27 | # makes this easy | |
28 | git cherry-pick --allow-empty "$revisions" | |
e481af06 | 29 | ret=$? |
90e1818f | 30 | else |
e481af06 AW |
31 | rm -f "$GIT_DIR/rebased-patches" |
32 | ||
90e1818f | 33 | git format-patch -k --stdout --full-index --ignore-if-in-upstream \ |
0597ffa5 FC |
34 | --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \ |
35 | $root_flag "$revisions" >"$GIT_DIR/rebased-patches" | |
e481af06 AW |
36 | ret=$? |
37 | ||
38 | if test 0 != $ret | |
39 | then | |
40 | rm -f "$GIT_DIR/rebased-patches" | |
41 | case "$head_name" in | |
42 | refs/heads/*) | |
43 | git checkout -q "$head_name" | |
44 | ;; | |
45 | *) | |
46 | git checkout -q "$orig_head" | |
47 | ;; | |
48 | esac | |
49 | ||
50 | cat >&2 <<-EOF | |
51 | ||
52 | git encountered an error while preparing the patches to replay | |
53 | these revisions: | |
54 | ||
55 | $revisions | |
56 | ||
57 | As a result, git cannot rebase them. | |
58 | EOF | |
a1549e10 | 59 | return $? |
e481af06 AW |
60 | fi |
61 | ||
62 | git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches" | |
63 | ret=$? | |
64 | ||
65 | rm -f "$GIT_DIR/rebased-patches" | |
66 | fi | |
67 | ||
68 | if test 0 != $ret | |
69 | then | |
70 | test -d "$state_dir" && write_basic_state | |
a1549e10 | 71 | return $ret |
e481af06 | 72 | fi |
90e1818f | 73 | |
e481af06 | 74 | move_to_original_branch |