aboutsummaryrefslogtreecommitdiff
path: root/t/t3404-rebase-interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-15 21:38:41 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-15 21:38:42 -0700
commit0cd993a778d7c14bed34f624fce46724242557ed (patch)
treecdd3284f5bd60e38751673953148793ccb1b79d1 /t/t3404-rebase-interactive.sh
parent77f3591dbbceebfd026d087709d91cd3a9b3e8a1 (diff)
parent994fd91d1fd5e9feffc88ab7db19e9c9461b4543 (diff)
downloadgit-0cd993a778d7c14bed34f624fce46724242557ed.tar.gz
git-0cd993a778d7c14bed34f624fce46724242557ed.tar.xz
Merge branch 'cw/rebase-i-root'
"git rebase [-i] --root $tip" can now be used to rewrite all the history down to the root. * cw/rebase-i-root: t3404: make test 57 work with dash and others Add tests for rebase -i --root without --onto rebase -i: support --root without --onto
Diffstat (limited to 't/t3404-rebase-interactive.sh')
-rwxr-xr-xt/t3404-rebase-interactive.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 68d61480f..8078db685 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -872,4 +872,35 @@ test_expect_success 'rebase -i --exec without <CMD>' '
git checkout master
'
+test_expect_success 'rebase -i --root re-order and drop commits' '
+ git checkout E &&
+ FAKE_LINES="3 1 2 5" git rebase -i --root &&
+ test E = $(git cat-file commit HEAD | sed -ne \$p) &&
+ test B = $(git cat-file commit HEAD^ | sed -ne \$p) &&
+ test A = $(git cat-file commit HEAD^^ | sed -ne \$p) &&
+ test C = $(git cat-file commit HEAD^^^ | sed -ne \$p) &&
+ test 0 = $(git cat-file commit HEAD^^^ | grep -c ^parent\ )
+'
+
+test_expect_success 'rebase -i --root retain root commit author and message' '
+ git checkout A &&
+ echo B >file7 &&
+ git add file7 &&
+ GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" &&
+ FAKE_LINES="2" git rebase -i --root &&
+ git cat-file commit HEAD | grep -q "^author Twerp Snog" &&
+ git cat-file commit HEAD | grep -q "^different author$"
+'
+
+test_expect_success 'rebase -i --root temporary sentinel commit' '
+ git checkout B &&
+ (
+ FAKE_LINES="2" &&
+ export FAKE_LINES &&
+ test_must_fail git rebase -i --root
+ ) &&
+ git cat-file commit HEAD | grep "^tree 4b825dc642cb" &&
+ git rebase --abort
+'
+
test_done