]> Pileus Git - ~andy/git/commitdiff
rebase -i: fix for optional [branch] parameter
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Wed, 1 Aug 2007 22:31:03 +0000 (23:31 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Aug 2007 01:17:56 +0000 (18:17 -0700)
When calling "git rebase -i <upstream> <branch>", git should switch
to <branch> first.  This worked before, but I broke it by my
"Shut git rebase -i up" patch.

Fix that, and add a test to make sure that it does not break again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh
t/t3404-rebase-interactive.sh

index d3addd4290cc202b8c5d0e41d4aa7acd4d2ac0a4..bdec4626090342141510600cf31fb0d796aea04d 100755 (executable)
@@ -405,6 +405,7 @@ do
 
                require_clean_work_tree
 
+               mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
                if test ! -z "$2"
                then
                        output git show-ref --verify --quiet "refs/heads/$2" ||
@@ -418,7 +419,6 @@ do
 
                test -z "$ONTO" && ONTO=$UPSTREAM
 
-               mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
                : > "$DOTEST"/interactive || die "Could not mark as interactive"
                git symbolic-ref HEAD > "$DOTEST"/head-name ||
                        die "Could not get HEAD"
index dc436d768e20f368fb4f517a2ba528e6da8f27a5..a9b552ff087fd6e45419e87f892b42da33ffed98 100755 (executable)
@@ -98,6 +98,14 @@ test_expect_success 'no changes are a nop' '
        test $(git rev-parse I) = $(git rev-parse HEAD)
 '
 
+test_expect_success 'test the [branch] option' '
+       git checkout -b dead-end &&
+       git rm file6 &&
+       git commit -m "stop here" &&
+       git rebase -i F branch2 &&
+       test $(git rev-parse I) = $(git rev-parse HEAD)
+'
+
 test_expect_success 'rebase on top of a non-conflicting commit' '
        git checkout branch1 &&
        git tag original-branch1 &&