@@ -30,6 +30,7 @@ test_expect_success 'setup a submodule tree' '
3030 git clone super submodule &&
3131 git clone super rebasing &&
3232 git clone super merging &&
33+ git clone super none &&
3334 (cd super &&
3435 git submodule add ../submodule submodule &&
3536 test_tick &&
@@ -58,6 +59,11 @@ test_expect_success 'setup a submodule tree' '
5859 test_tick &&
5960 git commit -m "rebasing"
6061 )
62+ (cd super &&
63+ git submodule add ../none none &&
64+ test_tick &&
65+ git commit -m "none"
66+ )
6167'
6268
6369test_expect_success ' submodule update detaching the HEAD ' '
@@ -298,6 +304,62 @@ test_expect_success 'submodule update ignores update=rebase config for new submo
298304 )
299305'
300306
307+ test_expect_success ' submodule init picks up update=none' '
308+ (cd super &&
309+ git config -f .gitmodules submodule.none.update none &&
310+ git submodule init none &&
311+ test "none" = "$(git config submodule.none.update)"
312+ )
313+ '
314+
315+ test_expect_success ' submodule update - update=none in .git/config' '
316+ (cd super &&
317+ git config submodule.submodule.update none &&
318+ (cd submodule &&
319+ git checkout master &&
320+ compare_head
321+ ) &&
322+ git diff --raw | grep " submodule" &&
323+ git submodule update &&
324+ git diff --raw | grep " submodule" &&
325+ (cd submodule &&
326+ compare_head
327+ ) &&
328+ git config --unset submodule.submodule.update &&
329+ git submodule update submodule
330+ )
331+ '
332+
333+ test_expect_success ' submodule update - update=none in .git/config but --checkout given' '
334+ (cd super &&
335+ git config submodule.submodule.update none &&
336+ (cd submodule &&
337+ git checkout master &&
338+ compare_head
339+ ) &&
340+ git diff --raw | grep " submodule" &&
341+ git submodule update --checkout &&
342+ test_must_fail git diff --raw \| grep " submodule" &&
343+ (cd submodule &&
344+ test_must_fail compare_head
345+ ) &&
346+ git config --unset submodule.submodule.update
347+ )
348+ '
349+
350+ test_expect_success ' submodule update --init skips submodule with update=none' '
351+ (cd super &&
352+ git add .gitmodules &&
353+ git commit -m ".gitmodules"
354+ ) &&
355+ git clone super cloned &&
356+ (cd cloned &&
357+ git submodule update --init &&
358+ test -e submodule/.git &&
359+ test_must_fail test -e none/.git
360+ )
361+ '
362+
301363test_expect_success ' submodule update continues after checkout error' '
302364 (cd super &&
303365 git reset --hard HEAD &&
0 commit comments