summaryrefslogtreecommitdiff
path: root/t/t7400-submodule-basic.sh
diff options
context:
space:
mode:
authorAtharva Raykar <raykar.ath@gmail.com>2021-07-06 18:19:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-07-07 18:00:01 (GMT)
commit84069fcc140480fb76dc204ebce7819c2c87ec7c (patch)
tree815a8ab832fe865ebda90a2a7e5f00e88f08a757 /t/t7400-submodule-basic.sh
parentebf3c04b262aa27fbb97f8a0156c2347fecafafb (diff)
downloadgit-84069fcc140480fb76dc204ebce7819c2c87ec7c.zip
git-84069fcc140480fb76dc204ebce7819c2c87ec7c.tar.gz
git-84069fcc140480fb76dc204ebce7819c2c87ec7c.tar.bz2
t7400: test failure to add submodule in tracked path
Add a test to ensure failure on adding a submodule to a directory with tracked contents in the index. As we are going to refactor and port to C some parts of `git submodule add`, let's add a test to help ensure no regression is introduced. Signed-off-by: Atharva Raykar <raykar.ath@gmail.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Based-on-patch-by: Shourya Shukla <periperidip@gmail.com> Mentored-by: Shourya Shukla <periperidip@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7400-submodule-basic.sh')
-rwxr-xr-xt/t7400-submodule-basic.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index a924fdb..7aa7fef 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -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 "'\''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 &&