@matheusbsbs / matheus-bagliano / commits / 69e66f5500
Fork 0

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". (a1bf91e fixed the same issue for non-interactive rebase.) Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Jun 2, 2008 at 16:01 UTC 69e66f5500ef6079e3374a6654ef1f6df0c6f360
1 file changed +3 -4
git-rebase--interactive.sh
+3 -4
@@ -475,6 +475,9 @@ do
475
476 require_clean_work_tree
477
478 + UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
479 + test -z "$ONTO" && ONTO=$UPSTREAM
480 +
481 if test ! -z "$2"
482 then
483 output git show-ref --verify --quiet "refs/heads/$2" ||
@@ -484,12 +487,8 @@ do
487 fi
488
489 HEAD=$(git rev-parse --verify HEAD) || die "No HEAD?"
487 - UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
488 -
490 mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
491
491 - test -z "$ONTO" && ONTO=$UPSTREAM
492 -
492 : > "$DOTEST"/interactive || die "Could not mark as interactive"
493 git symbolic-ref HEAD > "$DOTEST"/head-name 2> /dev/null ||
494 echo "detached HEAD" > "$DOTEST"/head-name