revision: fix leaking parents when simplifying commits
[git/gitster.git] / t / t3426-rebase-submodule.sh
blob94ea88e384e6219c7d47c6c9fb8409640623680d
1 #!/bin/sh
3 test_description='rebase can handle submodules'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7 . "$TEST_DIRECTORY"/lib-submodule-update.sh
8 . "$TEST_DIRECTORY"/lib-rebase.sh
10 git_rebase () {
11 git status -su >expect &&
12 ls -1pR * >>expect &&
13 git checkout -b ours HEAD &&
14 echo x >>file1 &&
15 git add file1 &&
16 git commit -m add_x &&
17 git revert HEAD &&
18 git status -su >actual &&
19 ls -1pR * >>actual &&
20 test_cmp expect actual &&
21 may_only_be_test_must_fail "$2" &&
22 $2 git rebase "$1"
25 test_submodule_switch_func "git_rebase"
27 git_rebase_interactive () {
28 git status -su >expect &&
29 ls -1pR * >>expect &&
30 git checkout -b ours HEAD &&
31 echo x >>file1 &&
32 git add file1 &&
33 git commit -m add_x &&
34 git revert HEAD &&
35 git status -su >actual &&
36 ls -1pR * >>actual &&
37 test_cmp expect actual &&
38 set_fake_editor &&
39 mkdir .git/info &&
40 echo "fake-editor.sh" >.git/info/exclude &&
41 may_only_be_test_must_fail "$2" &&
42 $2 git rebase -i "$1"
45 test_submodule_switch_func "git_rebase_interactive"
47 test_expect_success 'rebase interactive ignores modified submodules' '
48 test_when_finished "rm -rf super sub" &&
49 git init sub &&
50 git -C sub commit --allow-empty -m "Initial commit" &&
51 git init super &&
52 git -c protocol.file.allow=always \
53 -C super submodule add ../sub &&
54 git -C super config submodule.sub.ignore dirty &&
55 >super/foo &&
56 git -C super add foo &&
57 git -C super commit -m "Initial commit" &&
58 test_commit -C super a &&
59 test_commit -C super b &&
60 test_commit -C super/sub c &&
61 set_fake_editor &&
62 git -C super rebase -i HEAD^^
65 test_done