Add a test for rebase's new 'goto' and 'merge' commands
[git/dscho.git] / t / t3413-rebase-cmds.sh
blob8ac8a7d579f25e479db16fe80a7d9d45390350ce
1 #!/bin/sh
3 test_description='git rebase -i with non-standard commands
5 Tests that rebase -i understands "merge", "goto" and friends correctly
7 . ./test-lib.sh
9 . ../lib-rebase.sh
10 set_fake_editor
12 subject () {
13 git show -s --pretty=format:%s "$1"
16 test_expect_success 'prepare repository' '
18 test_commit ROOT &&
19 test_commit A &&
20 test_commit B &&
21 test_commit C
25 test_expect_success 'create merge' '
27 FAKE_LINES="2 merge A 3" git rebase -i -p ROOT &&
28 test C = $(subject HEAD) &&
29 test "Merge A" = "$(subject HEAD^)" &&
30 test A = $(subject HEAD^^2) &&
31 test B = $(subject HEAD~2) &&
32 test ROOT = $(subject HEAD~3)
36 test_expect_success 'goto' '
38 FAKE_LINES="goto A" git rebase -i -p ROOT &&
39 test A = $(subject HEAD) &&
40 test ROOT = $(subject HEAD^)
44 test_expect_success 'bookmark' '
46 FAKE_LINES="pick C pick B bookmark X goto HEAD^ pick A merge X'"'"'" \
47 git rebase -i -p ROOT &&
48 test ROOT = $(subject HEAD^2~2) &&
49 test ROOT = $(subject HEAD~3) &&
50 test $(git rev-parse C) != $(git rev-parse HEAD~2) &&
51 test A = $(subject HEAD^)
55 test_done