rebase--interactive: don't require what's rebased to be a branch
git rebase allows you to specify a non-branch commit-ish as the "branch" argument, which leaves HEAD detached when it's finished. This is occasionally useful, and this patch brings the same functionality to git rebase --interactive. Signed-off-by: Dave Olszewski <cxreg@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dave Olszewski committed
Mar 14, 2010 at 21:48 UTC
2ec33cdd19bd80308fcef45828e37e79c4b56dc5
2 files changed
+9
-2
git-rebase--interactive.sh
-2
@@ -783,8 +783,6 @@ first and then run 'git rebase --continue' again."
783
784
if test ! -z "$1"
785
then
786
- output git show-ref --verify --quiet "refs/heads/$1" ||
787
- die "Invalid branchname: $1"
786
output git checkout "$1" ||
787
die "Could not checkout $1"
788
fi
t/t3404-rebase-interactive.sh
+9
@@ -553,4 +553,13 @@ test_expect_success 'reword' '
553
git show HEAD~2 | grep "C changed"
554
'
555
556
+test_expect_success 'rebase while detaching HEAD' '
557
+ git symbolic-ref HEAD &&
558
+ grandparent=$(git rev-parse HEAD~2) &&
559
+ test_tick &&
560
+ FAKE_LINES="2 1" git rebase -i HEAD~2 HEAD^0 &&
561
+ test $grandparent = $(git rev-parse HEAD~2) &&
562
+ test_must_fail git symbolic-ref HEAD
563
+'
564
+
565
test_done