rebase -i: fix for optional [branch] parameter
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>
Johannes Schindelin committed
Aug 1, 2007 at 23:31 UTC
c9e6589288b09f4e631c7f12f0f9a77c29851632
2 files changed
+9
-1
git-rebase--interactive.sh
+1
-1
@@ -405,6 +405,7 @@ do
405
406
require_clean_work_tree
407
408
+ mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
409
if test ! -z "$2"
410
then
411
output git show-ref --verify --quiet "refs/heads/$2" ||
@@ -418,7 +419,6 @@ do
419
420
test -z "$ONTO" && ONTO=$UPSTREAM
421
421
- mkdir "$DOTEST" || die "Could not create temporary $DOTEST"
422
: > "$DOTEST"/interactive || die "Could not mark as interactive"
423
git symbolic-ref HEAD > "$DOTEST"/head-name ||
424
die "Could not get HEAD"
t/t3404-rebase-interactive.sh
+8
@@ -98,6 +98,14 @@ test_expect_success 'no changes are a nop' '
98
test $(git rev-parse I) = $(git rev-parse HEAD)
99
'
100
101
+test_expect_success 'test the [branch] option' '
102
+ git checkout -b dead-end &&
103
+ git rm file6 &&
104
+ git commit -m "stop here" &&
105
+ git rebase -i F branch2 &&
106
+ test $(git rev-parse I) = $(git rev-parse HEAD)
107
+'
108
+
109
test_expect_success 'rebase on top of a non-conflicting commit' '
110
git checkout branch1 &&
111
git tag original-branch1 &&