3 test_description
='git rebase -i with non-standard commands
5 Tests that rebase -i understands "merge", "goto" and friends correctly
13 git show
-s --pretty=format
:%s
"$1"
16 test_expect_success
'prepare repository' '
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 cat > rebase-script
<< \EOF
57 topic begin feature-branch
59 topic end feature-branch
62 test_expect_success
'topic' '
64 HEAD=$(git rev-parse HEAD) &&
67 REBASE_SCRIPT=rebase-script git rebase -i -p HEAD~2 &&
68 test E = $(subject HEAD^) &&
69 test D = $(subject HEAD^2) &&
70 test $HEAD = $(git rev-parse HEAD^2^) &&
71 (subject HEAD | grep feature-branch)