summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-08-04 13:28:52 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-04 13:28:52 -0700
commit10f57e0eb9070bf00c45def2980a47eacbae8316 (patch)
tree45cf2d38d0d0c9bf3702d830465398698351bf8e /t
parentGit 2.33-rc0 (diff)
parentsubmodule: drop unused sm_name parameter from show_fetch_remotes() (diff)
downloadtgif-10f57e0eb9070bf00c45def2980a47eacbae8316.tar.xz
Merge branch 'ar/submodule-add'
Rewrite of "git submodule" in C continues. * ar/submodule-add: submodule: drop unused sm_name parameter from show_fetch_remotes() submodule--helper: introduce add-clone subcommand submodule--helper: refactor module_clone() submodule: prefix die messages with 'fatal' t7400: test failure to add submodule in tracked path
Diffstat (limited to 't')
-rwxr-xr-xt/t7400-submodule-basic.sh13
-rwxr-xr-xt/t7406-submodule-update.sh10
2 files changed, 17 insertions, 6 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index a924fdb7a6..cb1b8e35db 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -51,7 +51,7 @@ test_expect_success 'submodule update aborts on missing gitmodules url' '
test_expect_success 'add aborts on repository with no commits' '
cat >expect <<-\EOF &&
- '"'repo-no-commits'"' does not have a commit checked out
+ fatal: '"'repo-no-commits'"' does not have a commit checked out
EOF
git init repo-no-commits &&
test_must_fail git submodule add ../a ./repo-no-commits 2>actual &&
@@ -196,6 +196,17 @@ test_expect_success 'submodule add to .gitignored path with --force' '
)
'
+test_expect_success 'submodule add to path with tracked content fails' '
+ (
+ cd addtest &&
+ echo "fatal: '\''dir-tracked'\'' already exists in the index" >expect &&
+ mkdir dir-tracked &&
+ test_commit foo dir-tracked/bar &&
+ test_must_fail git submodule add "$submodurl" dir-tracked >actual 2>&1 &&
+ test_cmp expect actual
+ )
+'
+
test_expect_success 'submodule add to reconfigure existing submodule with --force' '
(
cd addtest-ignore &&
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index f4f61fe554..11cccbb333 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -448,7 +448,7 @@ test_expect_success 'fsck detects command in .gitmodules' '
'
cat << EOF >expect
-Execution of 'false $submodulesha1' failed in submodule path 'submodule'
+fatal: Execution of 'false $submodulesha1' failed in submodule path 'submodule'
EOF
test_expect_success 'submodule update - command in .git/config catches failure' '
@@ -465,7 +465,7 @@ test_expect_success 'submodule update - command in .git/config catches failure'
'
cat << EOF >expect
-Execution of 'false $submodulesha1' failed in submodule path '../submodule'
+fatal: Execution of 'false $submodulesha1' failed in submodule path '../submodule'
EOF
test_expect_success 'submodule update - command in .git/config catches failure -- subdirectory' '
@@ -484,7 +484,7 @@ test_expect_success 'submodule update - command in .git/config catches failure -
test_expect_success 'submodule update - command run for initial population of submodule' '
cat >expect <<-EOF &&
- Execution of '\''false $submodulesha1'\'' failed in submodule path '\''submodule'\''
+ fatal: Execution of '\''false $submodulesha1'\'' failed in submodule path '\''submodule'\''
EOF
rm -rf super/submodule &&
test_must_fail git -C super submodule update 2>actual &&
@@ -493,8 +493,8 @@ test_expect_success 'submodule update - command run for initial population of su
'
cat << EOF >expect
-Execution of 'false $submodulesha1' failed in submodule path '../super/submodule'
-Failed to recurse into submodule path '../super'
+fatal: Execution of 'false $submodulesha1' failed in submodule path '../super/submodule'
+fatal: Failed to recurse into submodule path '../super'
EOF
test_expect_success 'recursive submodule update - command in .git/config catches failure -- subdirectory' '