Git 2.0-rc3
[git/mingw.git] / t / t3418-rebase-continue.sh
blob2680375628207d0d46ee4a9c8335840609461e0a
1 #!/bin/sh
3 test_description='git rebase --continue tests'
5 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-rebase.sh
9 set_fake_editor
11 test_expect_success 'setup' '
12 test_commit "commit-new-file-F1" F1 1 &&
13 test_commit "commit-new-file-F2" F2 2 &&
15 git checkout -b topic HEAD^ &&
16 test_commit "commit-new-file-F2-on-topic-branch" F2 22 &&
18 git checkout master
21 test_expect_success 'interactive rebase --continue works with touched file' '
22 rm -fr .git/rebase-* &&
23 git reset --hard &&
24 git checkout master &&
26 FAKE_LINES="edit 1" git rebase -i HEAD^ &&
27 test-chmtime =-60 F1 &&
28 git rebase --continue
31 test_expect_success 'non-interactive rebase --continue works with touched file' '
32 rm -fr .git/rebase-* &&
33 git reset --hard &&
34 git checkout master &&
36 test_must_fail git rebase --onto master master topic &&
37 echo "Resolved" >F2 &&
38 git add F2 &&
39 test-chmtime =-60 F1 &&
40 git rebase --continue
43 test_expect_success 'rebase --continue can not be used with other options' '
44 test_must_fail git rebase -v --continue &&
45 test_must_fail git rebase --continue -v
48 test_expect_success 'rebase --continue remembers merge strategy and options' '
49 rm -fr .git/rebase-* &&
50 git reset --hard commit-new-file-F2-on-topic-branch &&
51 test_commit "commit-new-file-F3-on-topic-branch" F3 32 &&
52 test_when_finished "rm -fr test-bin funny.was.run" &&
53 mkdir test-bin &&
54 cat >test-bin/git-merge-funny <<-EOF &&
55 #!$SHELL_PATH
56 case "\$1" in --opt) ;; *) exit 2 ;; esac
57 shift &&
58 >funny.was.run &&
59 exec git merge-recursive "\$@"
60 EOF
61 chmod +x test-bin/git-merge-funny &&
63 PATH=./test-bin:$PATH
64 test_must_fail git rebase -s funny -Xopt master topic
65 ) &&
66 test -f funny.was.run &&
67 rm funny.was.run &&
68 echo "Resolved" >F2 &&
69 git add F2 &&
71 PATH=./test-bin:$PATH
72 git rebase --continue
73 ) &&
74 test -f funny.was.run
77 test_expect_success 'rebase --continue remembers --rerere-autoupdate' '
78 rm -fr .git/rebase-* &&
79 git reset --hard commit-new-file-F3-on-topic-branch &&
80 git checkout master &&
81 test_commit "commit-new-file-F3" F3 3 &&
82 git config rerere.enabled true &&
83 test_must_fail git rebase -m master topic &&
84 echo "Resolved" >F2 &&
85 git add F2 &&
86 test_must_fail git rebase --continue &&
87 echo "Resolved" >F3 &&
88 git add F3 &&
89 git rebase --continue &&
90 git reset --hard topic@{1} &&
91 test_must_fail git rebase -m --rerere-autoupdate master &&
92 test "$(cat F2)" = "Resolved" &&
93 test_must_fail git rebase --continue &&
94 test "$(cat F3)" = "Resolved" &&
95 git rebase --continue
98 test_done