Code

Make 'unpack_trees()' have a separate source and destination index
[git.git] / git-rebase.sh
index 461ca8d93f4ab5c43792b4658d53b2e39ad18af1..452c5e7e01e168ec4fcdc5bb87caac3f326f95ea 100755 (executable)
@@ -61,7 +61,7 @@ continue_merge () {
        fi
 
        cmt=`cat "$dotest/current"`
-       if ! git diff-index --quiet HEAD
+       if ! git diff-index --quiet HEAD --
        then
                if ! git-commit -C "$cmt"
                then
@@ -208,16 +208,15 @@ do
                if test -d "$dotest"
                then
                        move_to_original_branch
-                       rm -r "$dotest"
                elif test -d .dotest
                then
                        dotest=.dotest
                        move_to_original_branch
-                       rm -r .dotest
                else
                        die "No rebase in progress?"
                fi
-               git reset --hard ORIG_HEAD
+               git reset --hard $(cat $dotest/orig-head)
+               rm -r "$dotest"
                exit
                ;;
        --onto)
@@ -285,7 +284,7 @@ fi
 
 # The tree must be really really clean.
 git update-index --refresh || exit
-diff=$(git diff-index --cached --name-status -r HEAD)
+diff=$(git diff-index --cached --name-status -r HEAD --)
 case "$diff" in
 ?*)    echo "cannot rebase: your index is not up-to-date"
        echo "$diff"
@@ -377,7 +376,7 @@ fi
 if test -z "$do_merge"
 then
        git format-patch -k --stdout --full-index --ignore-if-in-upstream "$upstream"..ORIG_HEAD |
-       git am $git_am_opt --binary -3 -k --resolvemsg="$RESOLVEMSG" &&
+       git am $git_am_opt --rebasing --resolvemsg="$RESOLVEMSG" &&
        move_to_original_branch
        ret=$?
        test 0 != $ret -a -d .dotest &&