Imported Upstream version 2.4.7
[platform/upstream/git.git] / git-rebase--am.sh
index ca20e1e..9ae898b 100644 (file)
@@ -29,7 +29,13 @@ skip)
        ;;
 esac
 
-test -n "$rebase_root" && root_flag=--root
+if test -z "$rebase_root"
+       # this is now equivalent to ! -z "$upstream"
+then
+       revisions=$upstream...$orig_head
+else
+       revisions=$onto...$orig_head
+fi
 
 ret=0
 if test -n "$keep_empty"
@@ -38,14 +44,17 @@ then
        # 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 ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty "$revisions"
+       git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty \
+               --right-only "$revisions" \
+               ${restrict_revision+^$restrict_revision}
        ret=$?
 else
        rm -f "$GIT_DIR/rebased-patches"
 
-       git format-patch -k --stdout --full-index --ignore-if-in-upstream \
+       git format-patch -k --stdout --full-index --cherry-pick --right-only \
                --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \
-               $root_flag "$revisions" >"$GIT_DIR/rebased-patches"
+               "$revisions" ${restrict_revision+^$restrict_revision} \
+               >"$GIT_DIR/rebased-patches"
        ret=$?
 
        if test 0 != $ret
@@ -69,7 +78,7 @@ else
 
                As a result, git cannot rebase them.
                EOF
-               return $?
+               return $ret
        fi
 
        git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \