summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2008-06-02 14:01:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-06-03 03:36:14 (GMT)
commit69e66f5500ef6079e3374a6654ef1f6df0c6f360 (patch)
treedad8587f8117efcdf8cbdcce735f32a470c507a7 /git-rebase--interactive.sh
parentc5833f6e1373e4e6a2c31a0cb6cd9050dc395643 (diff)
downloadgit-69e66f5500ef6079e3374a6654ef1f6df0c6f360.zip
git-69e66f5500ef6079e3374a6654ef1f6df0c6f360.tar.gz
git-69e66f5500ef6079e3374a6654ef1f6df0c6f360.tar.bz2
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>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 8ee08ff..0ca986f 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -475,6 +475,9 @@ do
require_clean_work_tree
+ UPSTREAM=$(git rev-parse --verify "$1") || die "Invalid base"
+ test -z "$ONTO" && ONTO=$UPSTREAM
+
if test ! -z "$2"
then
output git show-ref --verify --quiet "refs/heads/$2" ||
@@ -484,12 +487,8 @@ do
fi
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