use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t3403-rebase-skip.sh
blobee8a8dba528697569a8a3f469bd28200f555d763
1 #!/bin/sh
3 # Copyright (c) 2006 Eric Wong
6 test_description='git rebase --merge --skip tests'
8 . ./test-lib.sh
10 . "$TEST_DIRECTORY"/lib-rebase.sh
12 # we assume the default git am -3 --skip strategy is tested independently
13 # and always works :)
15 test_expect_success setup '
16 echo hello > hello &&
17 git add hello &&
18 git commit -m "hello" &&
19 git branch skip-reference &&
21 echo world >> hello &&
22 git commit -a -m "hello world" &&
23 echo goodbye >> hello &&
24 git commit -a -m "goodbye" &&
25 git tag goodbye &&
27 git checkout --detach &&
28 git checkout HEAD^ . &&
29 test_tick &&
30 git commit -m reverted-goodbye &&
31 git tag reverted-goodbye &&
33 git checkout -f skip-reference &&
34 echo moo > hello &&
35 git commit -a -m "we should skip this" &&
36 echo moo > cow &&
37 git add cow &&
38 git commit -m "this should not be skipped" &&
39 git branch pre-rebase skip-reference &&
40 git branch skip-merge skip-reference
43 test_expect_success 'rebase with git am -3 (default)' '
44 test_must_fail git rebase master
47 test_expect_success 'rebase --skip can not be used with other options' '
48 test_must_fail git rebase -v --skip &&
49 test_must_fail git rebase --skip -v
52 test_expect_success 'rebase --skip with am -3' '
53 git rebase --skip
56 test_expect_success 'rebase moves back to skip-reference' '
57 test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
58 git branch post-rebase &&
59 git reset --hard pre-rebase &&
60 test_must_fail git rebase master &&
61 echo "hello" > hello &&
62 git add hello &&
63 git rebase --continue &&
64 test refs/heads/skip-reference = $(git symbolic-ref HEAD) &&
65 git reset --hard post-rebase
68 test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
70 test_expect_success 'rebase with --merge' '
71 test_must_fail git rebase --merge master
74 test_expect_success 'rebase --skip with --merge' '
75 git rebase --skip
78 test_expect_success 'merge and reference trees equal' '
79 test -z "$(git diff-tree skip-merge skip-reference)"
82 test_expect_success 'moved back to branch correctly' '
83 test refs/heads/skip-merge = $(git symbolic-ref HEAD)
86 test_debug 'gitk --all & sleep 1'
88 test_expect_success 'fixup that empties commit fails' '
89 test_when_finished "git rebase --abort" &&
91 set_fake_editor &&
92 test_must_fail env FAKE_LINES="1 fixup 2" git rebase -i \
93 goodbye^ reverted-goodbye
97 test_expect_success 'squash that empties commit fails' '
98 test_when_finished "git rebase --abort" &&
100 set_fake_editor &&
101 test_must_fail env FAKE_LINES="1 squash 2" git rebase -i \
102 goodbye^ reverted-goodbye
106 # Must be the last test in this file
107 test_expect_success '$EDITOR and friends are unchanged' '
108 test_editor_unchanged
111 test_done