6
test_description='Test updating submodules
7
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
'
11
12
. ./test-lib.sh
76
)
77
'
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
+
93
test_expect_success 'submodule update - rebase in .git/config' '
94
(cd super &&
95
git config submodule.submodule.update rebase
124
)
125
'
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
+
161
test_expect_success 'submodule update - checkout in .git/config' '
162
(cd super &&
163
git config submodule.submodule.update checkout
185
)
186
'
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
+
198
test_done