298
)
299
'
300
301
+test_expect_success 'submodule update continues after checkout error' '
302
+ (cd super &&
303
+ git reset --hard HEAD &&
304
+ git submodule add ../submodule submodule2 &&
305
+ git submodule init &&
306
+ git commit -am "new_submodule" &&
307
+ (cd submodule2 &&
308
+ git rev-parse --max-count=1 HEAD > ../expect
309
+ ) &&
310
+ (cd submodule &&
311
+ test_commit "update_submodule" file
312
+ ) &&
313
+ (cd submodule2 &&
314
+ test_commit "update_submodule2" file
315
+ ) &&
316
+ git add submodule &&
317
+ git add submodule2 &&
318
+ git commit -m "two_new_submodule_commits" &&
319
+ (cd submodule &&
320
+ echo "" > file
321
+ ) &&
322
+ git checkout HEAD^ &&
323
+ test_must_fail git submodule update &&
324
+ (cd submodule2 &&
325
+ git rev-parse --max-count=1 HEAD > ../actual
326
+ ) &&
327
+ test_cmp expect actual
328
+ )
329
+'
330
+test_expect_success 'submodule update continues after recursive checkout error' '
331
+ (cd super &&
332
+ git reset --hard HEAD &&
333
+ git checkout master &&
334
+ git submodule update &&
335
+ (cd submodule &&
336
+ git submodule add ../submodule subsubmodule &&
337
+ git submodule init &&
338
+ git commit -m "new_subsubmodule"
339
+ ) &&
340
+ git add submodule &&
341
+ git commit -m "update_submodule" &&
342
+ (cd submodule &&
343
+ (cd subsubmodule &&
344
+ test_commit "update_subsubmodule" file
345
+ ) &&
346
+ git add subsubmodule &&
347
+ test_commit "update_submodule_again" file &&
348
+ (cd subsubmodule &&
349
+ test_commit "update_subsubmodule_again" file
350
+ ) &&
351
+ test_commit "update_submodule_again_again" file
352
+ ) &&
353
+ (cd submodule2 &&
354
+ git rev-parse --max-count=1 HEAD > ../expect &&
355
+ test_commit "update_submodule2_again" file
356
+ ) &&
357
+ git add submodule &&
358
+ git add submodule2 &&
359
+ git commit -m "new_commits" &&
360
+ git checkout HEAD^ &&
361
+ (cd submodule &&
362
+ git checkout HEAD^ &&
363
+ (cd subsubmodule &&
364
+ echo "" > file
365
+ )
366
+ ) &&
367
+ test_must_fail git submodule update --recursive &&
368
+ (cd submodule2 &&
369
+ git rev-parse --max-count=1 HEAD > ../actual
370
+ ) &&
371
+ test_cmp expect actual
372
+ )
373
+'
374
+
375
+test_expect_success 'submodule update exit immediately in case of merge conflict' '
376
+ (cd super &&
377
+ git checkout master &&
378
+ git reset --hard HEAD &&
379
+ (cd submodule &&
380
+ (cd subsubmodule &&
381
+ git reset --hard HEAD
382
+ )
383
+ ) &&
384
+ git submodule update --recursive &&
385
+ (cd submodule &&
386
+ test_commit "update_submodule_2" file
387
+ ) &&
388
+ (cd submodule2 &&
389
+ test_commit "update_submodule2_2" file
390
+ ) &&
391
+ git add submodule &&
392
+ git add submodule2 &&
393
+ git commit -m "two_new_submodule_commits" &&
394
+ (cd submodule &&
395
+ git checkout master &&
396
+ test_commit "conflict" file &&
397
+ echo "conflict" > file
398
+ ) &&
399
+ git checkout HEAD^ &&
400
+ (cd submodule2 &&
401
+ git rev-parse --max-count=1 HEAD > ../expect
402
+ ) &&
403
+ git config submodule.submodule.update merge &&
404
+ test_must_fail git submodule update &&
405
+ (cd submodule2 &&
406
+ git rev-parse --max-count=1 HEAD > ../actual
407
+ ) &&
408
+ test_cmp expect actual
409
+ )
410
+'
411
+test_expect_success 'submodule update exit immediately after recursive rebase error' '
412
+ (cd super &&
413
+ git checkout master &&
414
+ git reset --hard HEAD &&
415
+ (cd submodule &&
416
+ git reset --hard HEAD &&
417
+ git submodule update --recursive
418
+ ) &&
419
+ (cd submodule &&
420
+ test_commit "update_submodule_3" file
421
+ ) &&
422
+ (cd submodule2 &&
423
+ test_commit "update_submodule2_3" file
424
+ ) &&
425
+ git add submodule &&
426
+ git add submodule2 &&
427
+ git commit -m "two_new_submodule_commits" &&
428
+ (cd submodule &&
429
+ git checkout master &&
430
+ test_commit "conflict2" file &&
431
+ echo "conflict" > file
432
+ ) &&
433
+ git checkout HEAD^ &&
434
+ (cd submodule2 &&
435
+ git rev-parse --max-count=1 HEAD > ../expect
436
+ ) &&
437
+ git config submodule.submodule.update rebase &&
438
+ test_must_fail git submodule update &&
439
+ (cd submodule2 &&
440
+ git rev-parse --max-count=1 HEAD > ../actual
441
+ ) &&
442
+ test_cmp expect actual
443
+ )
444
+'
445
test_done