diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-07-15 21:38:41 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-15 21:38:42 -0700 |
commit | 0cd993a778d7c14bed34f624fce46724242557ed (patch) | |
tree | cdd3284f5bd60e38751673953148793ccb1b79d1 /t | |
parent | Merge branch 'pw/git-p4-move' (diff) | |
parent | t3404: make test 57 work with dash and others (diff) | |
download | tgif-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')
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 31 | ||||
-rwxr-xr-x | t/t3412-rebase-root.sh | 5 |
2 files changed, 31 insertions, 5 deletions
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 68d61480fb..8078db6856 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 diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh index 1e9d1a737c..0b52105728 100755 --- a/t/t3412-rebase-root.sh +++ b/t/t3412-rebase-root.sh @@ -22,11 +22,6 @@ test_expect_success 'prepare repository' ' test_commit 4 B ' -test_expect_success 'rebase --root expects --onto' ' - git checkout -B fail other && - test_must_fail git rebase --root -' - test_expect_success 'rebase --root fails with too many args' ' git checkout -B fail other && test_must_fail git rebase --onto master --root fail fail |