]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3403-rebase-skip.sh
The sixth batch for 2.26
[thirdparty/git.git] / t / t3403-rebase-skip.sh
CommitLineData
d5e673b6
EW
1#!/bin/sh
2#
3# Copyright (c) 2006 Eric Wong
4#
5
6test_description='git rebase --merge --skip tests'
7
8. ./test-lib.sh
9
2d05ef27
PW
10. "$TEST_DIRECTORY"/lib-rebase.sh
11
0cb0e143 12# we assume the default git am -3 --skip strategy is tested independently
d5e673b6
EW
13# and always works :)
14
d5e673b6
EW
15test_expect_success setup '
16 echo hello > hello &&
17 git add hello &&
18 git commit -m "hello" &&
19 git branch skip-reference &&
20
21 echo world >> hello &&
22 git commit -a -m "hello world" &&
23 echo goodbye >> hello &&
24 git commit -a -m "goodbye" &&
2d05ef27
PW
25 git tag goodbye &&
26
27 git checkout --detach &&
28 git checkout HEAD^ . &&
29 test_tick &&
30 git commit -m reverted-goodbye &&
31 git tag reverted-goodbye &&
d5e673b6
EW
32
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
41 '
42
41ac414e 43test_expect_success 'rebase with git am -3 (default)' '
d492b31c 44 test_must_fail git rebase master
4be60962 45'
d5e673b6 46
95135b06
MZ
47test_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
50'
51
d5e673b6 52test_expect_success 'rebase --skip with am -3' '
d5e673b6
EW
53 git rebase --skip
54 '
3f735b66
JS
55
56test_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 &&
d492b31c 60 test_must_fail git rebase master &&
3f735b66
JS
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
66'
67
d5e673b6
EW
68test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
69
d492b31c
SB
70test_expect_success 'rebase with --merge' '
71 test_must_fail git rebase --merge master
72'
d5e673b6
EW
73
74test_expect_success 'rebase --skip with --merge' '
d5e673b6 75 git rebase --skip
15c7348e 76'
d5e673b6 77
15c7348e 78test_expect_success 'merge and reference trees equal' '
c82ec45e 79 test -z "$(git diff-tree skip-merge skip-reference)"
15c7348e 80'
d5e673b6 81
3f735b66
JS
82test_expect_success 'moved back to branch correctly' '
83 test refs/heads/skip-merge = $(git symbolic-ref HEAD)
84'
85
d5e673b6
EW
86test_debug 'gitk --all & sleep 1'
87
2d05ef27
PW
88test_expect_success 'fixup that empties commit fails' '
89 test_when_finished "git rebase --abort" &&
90 (
91 set_fake_editor &&
92 test_must_fail env FAKE_LINES="1 fixup 2" git rebase -i \
93 goodbye^ reverted-goodbye
94 )
95'
96
97test_expect_success 'squash that empties commit fails' '
98 test_when_finished "git rebase --abort" &&
99 (
100 set_fake_editor &&
101 test_must_fail env FAKE_LINES="1 squash 2" git rebase -i \
102 goodbye^ reverted-goodbye
103 )
104'
105
106# Must be the last test in this file
107test_expect_success '$EDITOR and friends are unchanged' '
108 test_editor_unchanged
109'
110
d5e673b6 111test_done