summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-24 21:28:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-24 21:28:41 (GMT)
commitcda4ba30b1d6257524b9412ed4d7c44645fe0369 (patch)
treec02dddf0db7583b8a3f50dc08c6b375103f97ed8 /t
parentf31d23a399d557d687266b4375a0436f920cc051 (diff)
parent17f2f88c9c9e0015cba6d962dc6d9e2329ddf713 (diff)
downloadgit-cda4ba30b1d6257524b9412ed4d7c44645fe0369.zip
git-cda4ba30b1d6257524b9412ed4d7c44645fe0369.tar.gz
git-cda4ba30b1d6257524b9412ed4d7c44645fe0369.tar.bz2
Merge branch 'jk/warn-add-gitlink'
Using "git add d/i/r" when d/i/r is the top of the working tree of a separate repository would create a gitlink in the index, which would appear as a not-quite-initialized submodule to others. We learned to give warnings when this happens. * jk/warn-add-gitlink: t: move "git add submodule" into test blocks add: warn when adding an embedded repository
Diffstat (limited to 't')
-rwxr-xr-xt/t4041-diff-submodule-option.sh8
-rwxr-xr-xt/t4060-diff-submodule-option-diff-format.sh8
-rwxr-xr-xt/t7401-submodule-summary.sh8
-rwxr-xr-xt/t7414-submodule-mistakes.sh37
4 files changed, 52 insertions, 9 deletions
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 2d9731b..058ee08 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -430,9 +430,11 @@ test_expect_success 'deleted submodule' '
test_cmp expected actual
'
-test_create_repo sm2 &&
-head7=$(add_file sm2 foo8 foo9) &&
-git add sm2
+test_expect_success 'create second submodule' '
+ test_create_repo sm2 &&
+ head7=$(add_file sm2 foo8 foo9) &&
+ git add sm2
+'
test_expect_success 'multiple submodules' '
git diff-index -p --submodule=log HEAD >actual &&
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index 33ec26d..4b168d0 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -643,9 +643,11 @@ test_expect_success 'deleted submodule' '
test_cmp expected actual
'
-test_create_repo sm2 &&
-head7=$(add_file sm2 foo8 foo9) &&
-git add sm2
+test_expect_success 'create second submodule' '
+ test_create_repo sm2 &&
+ head7=$(add_file sm2 foo8 foo9) &&
+ git add sm2
+'
test_expect_success 'multiple submodules' '
git diff-index -p --submodule=diff HEAD >actual &&
diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh
index 366746f..4e4c455 100755
--- a/t/t7401-submodule-summary.sh
+++ b/t/t7401-submodule-summary.sh
@@ -241,9 +241,11 @@ EOF
test_cmp expected actual
"
-test_create_repo sm2 &&
-head7=$(add_file sm2 foo8 foo9) &&
-git add sm2
+test_expect_success 'create second submodule' '
+ test_create_repo sm2 &&
+ head7=$(add_file sm2 foo8 foo9) &&
+ git add sm2
+'
test_expect_success 'multiple submodules' "
git submodule summary >actual &&
diff --git a/t/t7414-submodule-mistakes.sh b/t/t7414-submodule-mistakes.sh
new file mode 100755
index 0000000..f2e7df5
--- /dev/null
+++ b/t/t7414-submodule-mistakes.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+test_description='handling of common mistakes people may make with submodules'
+. ./test-lib.sh
+
+test_expect_success 'create embedded repository' '
+ git init embed &&
+ test_commit -C embed one
+'
+
+test_expect_success 'git-add on embedded repository warns' '
+ test_when_finished "git rm --cached -f embed" &&
+ git add embed 2>stderr &&
+ test_i18ngrep warning stderr
+'
+
+test_expect_success '--no-warn-embedded-repo suppresses warning' '
+ test_when_finished "git rm --cached -f embed" &&
+ git add --no-warn-embedded-repo embed 2>stderr &&
+ test_i18ngrep ! warning stderr
+'
+
+test_expect_success 'no warning when updating entry' '
+ test_when_finished "git rm --cached -f embed" &&
+ git add embed &&
+ git -C embed commit --allow-empty -m two &&
+ git add embed 2>stderr &&
+ test_i18ngrep ! warning stderr
+'
+
+test_expect_success 'submodule add does not warn' '
+ test_when_finished "git rm -rf submodule .gitmodules" &&
+ git submodule add ./embed submodule 2>stderr &&
+ test_i18ngrep ! warning stderr
+'
+
+test_done