]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3426-rebase-submodule.sh
Merge branch 'ea/blame-use-oideq'
[thirdparty/git.git] / t / t3426-rebase-submodule.sh
CommitLineData
c7e69168
JL
1#!/bin/sh
2
3test_description='rebase can handle submodules'
4
5. ./test-lib.sh
6. "$TEST_DIRECTORY"/lib-submodule-update.sh
7. "$TEST_DIRECTORY"/lib-rebase.sh
8
9git_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 &&
5b0ac09f
DL
20 may_only_be_test_must_fail "$2" &&
21 $2 git rebase "$1"
c7e69168
JL
22}
23
aa06180a 24test_submodule_switch_func "git_rebase"
c7e69168
JL
25
26git_rebase_interactive () {
27 git status -su >expect &&
28 ls -1pR * >>expect &&
29 git checkout -b ours HEAD &&
30 echo x >>file1 &&
31 git add file1 &&
32 git commit -m add_x &&
33 git revert HEAD &&
34 git status -su >actual &&
35 ls -1pR * >>actual &&
36 test_cmp expect actual &&
37 set_fake_editor &&
38 echo "fake-editor.sh" >.git/info/exclude &&
5b0ac09f
DL
39 may_only_be_test_must_fail "$2" &&
40 $2 git rebase -i "$1"
c7e69168
JL
41}
42
aa06180a 43test_submodule_switch_func "git_rebase_interactive"
c7e69168 44
c6d8ccf3
BW
45test_expect_success 'rebase interactive ignores modified submodules' '
46 test_when_finished "rm -rf super sub" &&
47 git init sub &&
48 git -C sub commit --allow-empty -m "Initial commit" &&
49 git init super &&
50 git -C super submodule add ../sub &&
51 git -C super config submodule.sub.ignore dirty &&
52 >super/foo &&
53 git -C super add foo &&
54 git -C super commit -m "Initial commit" &&
55 test_commit -C super a &&
56 test_commit -C super b &&
57 test_commit -C super/sub c &&
58 set_fake_editor &&
59 git -C super rebase -i HEAD^^
60'
61
c7e69168 62test_done