Code

git-stash: try reusing cached stat info as much as possible
[git.git] / git-rebase.sh
index c5906611794adadfbd37463481412abae6f11a8f..cbafa14ed524212441ba76e1bdb558585795e2f3 100755 (executable)
@@ -101,7 +101,7 @@ call_merge () {
                return
                ;;
        1)
-               test -d "$GIT_DIR/rr-cache" && git rerere
+               git rerere
                die "$RESOLVEMSG"
                ;;
        2)
@@ -160,10 +160,7 @@ do
        --skip)
                if test -d "$dotest"
                then
-                       if test -d "$GIT_DIR/rr-cache"
-                       then
-                               git rerere clear
-                       fi
+                       git rerere clear
                        prev_head="`cat $dotest/prev_head`"
                        end="`cat $dotest/end`"
                        msgnum="`cat $dotest/msgnum`"
@@ -181,10 +178,7 @@ do
                exit
                ;;
        --abort)
-               if test -d "$GIT_DIR/rr-cache"
-               then
-                       git rerere clear
-               fi
+               git rerere clear
                if test -d "$dotest"
                then
                        rm -r "$dotest"
@@ -305,10 +299,12 @@ branch=$(git rev-parse --verify "${branch_name}^0") || exit
 
 # Now we are rebasing commits $upstream..$branch on top of $onto
 
-# Check if we are already based on $onto, but this should be
-# done only when upstream and onto are the same.
+# Check if we are already based on $onto with linear history,
+# but this should be done only when upstream and onto are the same.
 mb=$(git merge-base "$onto" "$branch")
-if test "$upstream" = "$onto" && test "$mb" = "$onto"
+if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
+       # linear history?
+       ! git rev-list --parents "$onto".."$branch" | grep " .* " > /dev/null
 then
        echo >&2 "Current branch $branch_name is up to date."
        exit 0