|
6 | 6 | test_description='Test updating submodules |
7 | 7 |
|
8 | 8 | This test verifies that "git submodule update" detaches the HEAD of the |
9 | | -submodule and "git submodule update --rebase" does not detach the HEAD. |
| 9 | +submodule and "git submodule update --rebase/--merge" does not detach the HEAD. |
10 | 10 | ' |
11 | 11 |
|
12 | 12 | . ./test-lib.sh |
@@ -76,6 +76,20 @@ test_expect_success 'submodule update --rebase staying on master' ' |
76 | 76 | ) |
77 | 77 | ' |
78 | 78 |
|
| 79 | +test_expect_success 'submodule update --merge staying on master' ' |
| 80 | + (cd super/submodule && |
| 81 | + git reset --hard HEAD~1 |
| 82 | + ) && |
| 83 | + (cd super && |
| 84 | + (cd submodule && |
| 85 | + compare_head |
| 86 | + ) && |
| 87 | + git submodule update --merge submodule && |
| 88 | + cd submodule && |
| 89 | + compare_head |
| 90 | + ) |
| 91 | +' |
| 92 | + |
79 | 93 | test_expect_success 'submodule update - rebase in .git/config' ' |
80 | 94 | (cd super && |
81 | 95 | git config submodule.submodule.update rebase |
@@ -110,6 +124,40 @@ test_expect_success 'submodule update - checkout in .git/config but --rebase giv |
110 | 124 | ) |
111 | 125 | ' |
112 | 126 |
|
| 127 | +test_expect_success 'submodule update - merge in .git/config' ' |
| 128 | + (cd super && |
| 129 | + git config submodule.submodule.update merge |
| 130 | + ) && |
| 131 | + (cd super/submodule && |
| 132 | + git reset --hard HEAD~1 |
| 133 | + ) && |
| 134 | + (cd super && |
| 135 | + (cd submodule && |
| 136 | + compare_head |
| 137 | + ) && |
| 138 | + git submodule update submodule && |
| 139 | + cd submodule && |
| 140 | + compare_head |
| 141 | + ) |
| 142 | +' |
| 143 | + |
| 144 | +test_expect_success 'submodule update - checkout in .git/config but --merge given' ' |
| 145 | + (cd super && |
| 146 | + git config submodule.submodule.update checkout |
| 147 | + ) && |
| 148 | + (cd super/submodule && |
| 149 | + git reset --hard HEAD~1 |
| 150 | + ) && |
| 151 | + (cd super && |
| 152 | + (cd submodule && |
| 153 | + compare_head |
| 154 | + ) && |
| 155 | + git submodule update --merge submodule && |
| 156 | + cd submodule && |
| 157 | + compare_head |
| 158 | + ) |
| 159 | +' |
| 160 | + |
113 | 161 | test_expect_success 'submodule update - checkout in .git/config' ' |
114 | 162 | (cd super && |
115 | 163 | git config submodule.submodule.update checkout |
@@ -137,4 +185,14 @@ test_expect_success 'submodule init picks up rebase' ' |
137 | 185 | ) |
138 | 186 | ' |
139 | 187 |
|
| 188 | +test_expect_success 'submodule init picks up merge' ' |
| 189 | + (cd super && |
| 190 | + git config submodule.merging.url git://non-existing/git && |
| 191 | + git config submodule.merging.path does-not-matter && |
| 192 | + git config submodule.merging.update merge && |
| 193 | + git submodule init merging && |
| 194 | + test "merge" = $(git config submodule.merging.update) |
| 195 | + ) |
| 196 | +' |
| 197 | + |
140 | 198 | test_done |
0 commit comments