408
test_cmp expect actual
409
)
410
'
411
+
412
test_expect_success 'submodule update exit immediately after recursive rebase error' '
413
(cd super &&
414
git checkout master &&
443
test_cmp expect actual
444
)
445
'
446
+
447
+test_expect_success 'add different submodules to the same path' '
448
+ (cd super &&
449
+ git submodule add ../submodule s1 &&
450
+ test_must_fail git submodule add ../merging s1
451
+ )
452
+'
453
+
454
+test_expect_success 'submodule add places git-dir in superprojects git-dir' '
455
+ (cd super &&
456
+ mkdir deeper &&
457
+ git submodule add ../submodule deeper/submodule &&
458
+ (cd deeper/submodule &&
459
+ git log > ../../expected
460
+ ) &&
461
+ (cd .git/modules/deeper/submodule &&
462
+ git log > ../../../../actual
463
+ ) &&
464
+ test_cmp actual expected
465
+ )
466
+'
467
+
468
+test_expect_success 'submodule update places git-dir in superprojects git-dir' '
469
+ (cd super &&
470
+ git commit -m "added submodule"
471
+ ) &&
472
+ git clone super super2 &&
473
+ (cd super2 &&
474
+ git submodule init deeper/submodule &&
475
+ git submodule update &&
476
+ (cd deeper/submodule &&
477
+ git log > ../../expected
478
+ ) &&
479
+ (cd .git/modules/deeper/submodule &&
480
+ git log > ../../../../actual
481
+ ) &&
482
+ test_cmp actual expected
483
+ )
484
+'
485
+
486
+test_expect_success 'submodule add places git-dir in superprojects git-dir recursive' '
487
+ (cd super2 &&
488
+ (cd deeper/submodule &&
489
+ git submodule add ../submodule subsubmodule &&
490
+ (cd subsubmodule &&
491
+ git log > ../../../expected
492
+ ) &&
493
+ git commit -m "added subsubmodule" &&
494
+ git push
495
+ ) &&
496
+ (cd .git/modules/deeper/submodule/modules/subsubmodule &&
497
+ git log > ../../../../../actual
498
+ ) &&
499
+ git add deeper/submodule &&
500
+ git commit -m "update submodule" &&
501
+ git push &&
502
+ test_cmp actual expected
503
+ )
504
+'
505
+
506
+test_expect_success 'submodule update places git-dir in superprojects git-dir recursive' '
507
+ mkdir super_update_r &&
508
+ (cd super_update_r &&
509
+ git init --bare
510
+ ) &&
511
+ mkdir subsuper_update_r &&
512
+ (cd subsuper_update_r &&
513
+ git init --bare
514
+ ) &&
515
+ mkdir subsubsuper_update_r &&
516
+ (cd subsubsuper_update_r &&
517
+ git init --bare
518
+ ) &&
519
+ git clone subsubsuper_update_r subsubsuper_update_r2 &&
520
+ (cd subsubsuper_update_r2 &&
521
+ test_commit "update_subsubsuper" file &&
522
+ git push origin master
523
+ ) &&
524
+ git clone subsuper_update_r subsuper_update_r2 &&
525
+ (cd subsuper_update_r2 &&
526
+ test_commit "update_subsuper" file &&
527
+ git submodule add ../subsubsuper_update_r subsubmodule &&
528
+ git commit -am "subsubmodule" &&
529
+ git push origin master
530
+ ) &&
531
+ git clone super_update_r super_update_r2 &&
532
+ (cd super_update_r2 &&
533
+ test_commit "update_super" file &&
534
+ git submodule add ../subsuper_update_r submodule &&
535
+ git commit -am "submodule" &&
536
+ git push origin master
537
+ ) &&
538
+ rm -rf super_update_r2 &&
539
+ git clone super_update_r super_update_r2 &&
540
+ (cd super_update_r2 &&
541
+ git submodule update --init --recursive &&
542
+ (cd submodule/subsubmodule &&
543
+ git log > ../../expected
544
+ ) &&
545
+ (cd .git/modules/submodule/modules/subsubmodule
546
+ git log > ../../../../../actual
547
+ )
548
+ test_cmp actual expected
549
+ )
550
+'
551
+
552
test_done