submodule: additional regression tests for relative URLs
Some additional tests are added to support regression testing of the changes in the remainder of the series. We also add a pristine copy of .gitmodules in anticipation of this being required by later tests. Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jon Seymour committed
Jun 3, 2012 at 19:46 UTC
712693e8dbf188d4e9337c065617f09f7a0d1a16
1 file changed
+107
-3
t/t7400-submodule-basic.sh
+107
-3
@@ -483,21 +483,67 @@ test_expect_success 'set up for relative path tests' '
483
git add sub &&
484
git config -f .gitmodules submodule.sub.path sub &&
485
git config -f .gitmodules submodule.sub.url ../subrepo &&
486
- cp .git/config pristine-.git-config
486
+ cp .git/config pristine-.git-config &&
487
+ cp .gitmodules pristine-.gitmodules
488
)
489
'
490
490
-test_expect_success 'relative path works with URL' '
491
+test_expect_success '../subrepo works with URL - ssh://hostname/repo' '
492
(
493
cd reltest &&
494
cp pristine-.git-config .git/config &&
495
+ cp pristine-.gitmodules .gitmodules &&
496
git config remote.origin.url ssh://hostname/repo &&
497
git submodule init &&
498
test "$(git config submodule.sub.url)" = ssh://hostname/subrepo
499
)
500
'
501
500
-test_expect_success 'relative path works with user@host:path' '
502
+test_expect_success '../subrepo works with port-qualified URL - ssh://hostname:22/repo' '
503
+ (
504
+ cd reltest &&
505
+ cp pristine-.git-config .git/config &&
506
+ cp pristine-.gitmodules .gitmodules &&
507
+ git config remote.origin.url ssh://hostname:22/repo &&
508
+ git submodule init &&
509
+ test "$(git config submodule.sub.url)" = ssh://hostname:22/subrepo
510
+ )
511
+'
512
+
513
+test_expect_success '../subrepo path works with local path - /foo/repo' '
514
+ (
515
+ cd reltest &&
516
+ cp pristine-.git-config .git/config &&
517
+ cp pristine-.gitmodules .gitmodules &&
518
+ git config remote.origin.url /foo/repo &&
519
+ git submodule init &&
520
+ test "$(git config submodule.sub.url)" = /foo/subrepo
521
+ )
522
+'
523
+
524
+test_expect_success '../subrepo works with file URL - file:///tmp/repo' '
525
+ (
526
+ cd reltest &&
527
+ cp pristine-.git-config .git/config &&
528
+ cp pristine-.gitmodules .gitmodules &&
529
+ git config remote.origin.url file:///tmp/repo &&
530
+ git submodule init &&
531
+ test "$(git config submodule.sub.url)" = file:///tmp/subrepo
532
+ )
533
+'
534
+
535
+test_expect_success '../subrepo works with helper URL- helper:://hostname/repo' '
536
+ (
537
+ cd reltest &&
538
+ cp pristine-.git-config .git/config &&
539
+ cp pristine-.gitmodules .gitmodules &&
540
+ git config remote.origin.url helper:://hostname/repo &&
541
+ git submodule init &&
542
+ test "$(git config submodule.sub.url)" = helper:://hostname/subrepo
543
+ )
544
+'
545
+
546
+test_expect_success '../subrepo works with scp-style URL - user@host:repo' '
547
(
548
cd reltest &&
549
cp pristine-.git-config .git/config &&
@@ -507,6 +553,64 @@ test_expect_success 'relative path works with user@host:path' '
553
)
554
'
555
556
+test_expect_success '../subrepo works with scp-style URL - user@host:path/to/repo' '
557
+ (
558
+ cd reltest &&
559
+ cp pristine-.git-config .git/config &&
560
+ cp pristine-.gitmodules .gitmodules &&
561
+ git config remote.origin.url user@host:path/to/repo &&
562
+ git submodule init &&
563
+ test "$(git config submodule.sub.url)" = user@host:path/to/subrepo
564
+ )
565
+'
566
+
567
+test_expect_success '../subrepo works with relative local path - foo/bar' '
568
+ (
569
+ cd reltest &&
570
+ cp pristine-.git-config .git/config &&
571
+ cp pristine-.gitmodules .gitmodules &&
572
+ git config remote.origin.url foo/bar &&
573
+ git submodule init &&
574
+ test "$(git config submodule.sub.url)" = foo/subrepo
575
+ )
576
+'
577
+
578
+test_expect_success '../subrepo works with relative local path - ../foo' '
579
+ (
580
+ cd reltest &&
581
+ cp pristine-.git-config .git/config &&
582
+ cp pristine-.gitmodules .gitmodules &&
583
+ git config remote.origin.url ../foo &&
584
+ git submodule init &&
585
+ test "$(git config submodule.sub.url)" = ../subrepo
586
+ )
587
+'
588
+
589
+test_expect_success '../subrepo works with relative local path - ../foo/bar' '
590
+ (
591
+ cd reltest &&
592
+ cp pristine-.git-config .git/config &&
593
+ cp pristine-.gitmodules .gitmodules &&
594
+ git config remote.origin.url ../foo/bar &&
595
+ git submodule init &&
596
+ test "$(git config submodule.sub.url)" = ../foo/subrepo
597
+ )
598
+'
599
+
600
+test_expect_success '../bar/a/b/c works with relative local path - ../foo/bar.git' '
601
+ (
602
+ cd reltest &&
603
+ cp pristine-.git-config .git/config &&
604
+ cp pristine-.gitmodules .gitmodules &&
605
+ mkdir -p a/b/c &&
606
+ (cd a/b/c; git init) &&
607
+ git config remote.origin.url ../foo/bar.git &&
608
+ git submodule add ../bar/a/b/c ./a/b/c &&
609
+ git submodule init &&
610
+ test "$(git config submodule.a/b/c.url)" = ../foo/bar/a/b/c
611
+ )
612
+'
613
+
614
test_expect_success 'moving the superproject does not break submodules' '
615
(
616
cd addtest &&