t/helper: merge test-sigchain into test-tool
[alt-git.git] / t / t3426-rebase-submodule.sh
bloba2bba04ba96cb5e16dfbecf3f0d6180e150a7ec0
1 #!/bin/sh
3 test_description='rebase can handle submodules'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-submodule-update.sh
7 . "$TEST_DIRECTORY"/lib-rebase.sh
9 git_rebase () {
10 git status -su >expect &&
11 ls -1pR * >>expect &&
12 git checkout -b ours HEAD &&
13 echo x >>file1 &&
14 git add file1 &&
15 git commit -m add_x &&
16 git revert HEAD &&
17 git status -su >actual &&
18 ls -1pR * >>actual &&
19 test_cmp expect actual &&
20 git rebase "$1"
23 test_submodule_switch "git_rebase"
25 git_rebase_interactive () {
26 git status -su >expect &&
27 ls -1pR * >>expect &&
28 git checkout -b ours HEAD &&
29 echo x >>file1 &&
30 git add file1 &&
31 git commit -m add_x &&
32 git revert HEAD &&
33 git status -su >actual &&
34 ls -1pR * >>actual &&
35 test_cmp expect actual &&
36 set_fake_editor &&
37 echo "fake-editor.sh" >.git/info/exclude &&
38 git rebase -i "$1"
41 test_submodule_switch "git_rebase_interactive"
43 test_expect_success 'rebase interactive ignores modified submodules' '
44 test_when_finished "rm -rf super sub" &&
45 git init sub &&
46 git -C sub commit --allow-empty -m "Initial commit" &&
47 git init super &&
48 git -C super submodule add ../sub &&
49 git -C super config submodule.sub.ignore dirty &&
50 >super/foo &&
51 git -C super add foo &&
52 git -C super commit -m "Initial commit" &&
53 test_commit -C super a &&
54 test_commit -C super b &&
55 test_commit -C super/sub c &&
56 set_fake_editor &&
57 git -C super rebase -i HEAD^^
60 test_done