ls-remote doc: rewrite <repository> paragraph
[git/gitweb.git] / git-rebase--am.sh
blob34e3102fcbfa64ec101c1fe009c9b14a5976e4c2
1 #!/bin/sh
3 # Copyright (c) 2010 Junio C Hamano.
6 case "$action" in
7 continue)
8 git am --resolved --resolvemsg="$resolvemsg" &&
9 move_to_original_branch
10 return
12 skip)
13 git am --skip --resolvemsg="$resolvemsg" &&
14 move_to_original_branch
15 return
17 esac
19 test -n "$rebase_root" && root_flag=--root
21 ret=0
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"
29 ret=$?
30 else
31 rm -f "$GIT_DIR/rebased-patches"
33 git format-patch -k --stdout --full-index --ignore-if-in-upstream \
34 --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
35 $root_flag "$revisions" >"$GIT_DIR/rebased-patches"
36 ret=$?
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"
46 git checkout -q "$orig_head"
48 esac
50 cat >&2 <<-EOF
52 git encountered an error while preparing the patches to replay
53 these revisions:
55 $revisions
57 As a result, git cannot rebase them.
58 EOF
59 return $?
62 git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches"
63 ret=$?
65 rm -f "$GIT_DIR/rebased-patches"
68 if test 0 != $ret
69 then
70 test -d "$state_dir" && write_basic_state
71 return $ret
74 move_to_original_branch