Commit 69e66f55 authored by Johannes Sixt's avatar Johannes Sixt Committed by Junio C Hamano

rebase --interactive: Compute upstream SHA1 before switching branches

If the upstream argument to rebase (the first argument) was relative to
HEAD and the name of the branch to rebase (the second argument) was given,
the upstream would have been interpreted relative to the second argument.
In particular, this command

    git rebase -i HEAD topic

would always finish with "Nothing to do". (a1bf91e0 fixed the same issue
for non-interactive rebase.)
Signed-off-by: default avatarJohannes Sixt <[email protected]>
Acked-by: Johannes Schindelin's avatarJohannes Schindelin <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent c5833f6e
......@@ -475,6 +475,9 @@ do
UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
test -z "$ONTO" && ONTO=$UPSTREAM
if test ! -z "$2"
output git show-ref --verify --quiet "refs/heads/$2" ||
......@@ -484,12 +487,8 @@ do
HEAD=$(git rev-parse --verify HEAD) || die "No HEAD?"
UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
test -z "$ONTO" && ONTO=$UPSTREAM
: > "$DOTEST"/interactive || die "Could not mark as interactive"
git symbolic-ref HEAD > "$DOTEST"/head-name 2> /dev/null ||
echo "detached HEAD" > "$DOTEST"/head-name
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment