mailmap: simplify map_user() interface
[gitweb.git] / git-rebase--am.sh
index 263987c55db053b3cb5455704b5206f272599fb8..392ebc9790c88f9857fc4e943d1fe6351e953c7d 100644 (file)
@@ -3,16 +3,14 @@
 # Copyright (c) 2010 Junio C Hamano.
 #
 
-. git-sh-setup
-
 case "$action" in
 continue)
-       git am --resolved --3way --resolvemsg="$resolvemsg" &&
+       git am --resolved --resolvemsg="$resolvemsg" &&
        move_to_original_branch
        exit
        ;;
 skip)
-       git am --skip -3 --resolvemsg="$resolvemsg" &&
+       git am --skip --resolvemsg="$resolvemsg" &&
        move_to_original_branch
        exit
        ;;
@@ -20,15 +18,20 @@ esac
 
 test -n "$rebase_root" && root_flag=--root
 
-git format-patch -k --stdout --full-index --ignore-if-in-upstream \
-       --src-prefix=a/ --dst-prefix=b/ \
-       --no-renames $root_flag "$revisions" |
-git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" &&
-move_to_original_branch
+if test -n "$keep_empty"
+then
+       # we have to do this the hard way.  git format-patch completely squashes
+       # empty commits and even if it didn't the format doesn't really lend
+       # itself well to recording empty patches.  fortunately, cherry-pick
+       # makes this easy
+       git cherry-pick --allow-empty "$revisions"
+else
+       git format-patch -k --stdout --full-index --ignore-if-in-upstream \
+               --src-prefix=a/ --dst-prefix=b/ \
+               --no-renames $root_flag "$revisions" |
+       git am $git_am_opt --rebasing --resolvemsg="$resolvemsg"
+fi && move_to_original_branch
+
 ret=$?
-test 0 != $ret -a -d "$state_dir" &&
-       echo $head_name > "$state_dir/head-name" &&
-       echo $onto > "$state_dir/onto" &&
-       echo $orig_head > "$state_dir/orig-head" &&
-       echo "$GIT_QUIET" > "$state_dir/quiet"
+test 0 != $ret -a -d "$state_dir" && write_basic_state
 exit $ret