summaryrefslogtreecommitdiff
path: root/t/t7400-submodule-basic.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t7400-submodule-basic.sh')
-rwxr-xr-xt/t7400-submodule-basic.sh40
1 files changed, 38 insertions, 2 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 7f75bb1..e3e2aab 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -55,6 +55,21 @@ test_expect_success 'add aborts on repository with no commits' '
test_i18ncmp expect actual
'
+test_expect_success 'status should ignore inner git repo when not added' '
+ rm -fr inner &&
+ mkdir inner &&
+ (
+ cd inner &&
+ git init &&
+ >t &&
+ git add t &&
+ git commit -m "initial"
+ ) &&
+ test_must_fail git submodule status inner 2>output.err &&
+ rm -fr inner &&
+ test_i18ngrep "^error: .*did not match any file(s) known to git" output.err
+'
+
test_expect_success 'setup - repository in init subdirectory' '
mkdir init &&
(
@@ -156,9 +171,11 @@ test_expect_success 'submodule add to .gitignored path fails' '
(
cd addtest-ignore &&
cat <<-\EOF >expect &&
- The following path is ignored by one of your .gitignore files:
+ The following paths are ignored by one of your .gitignore files:
submod
- Use -f if you really want to add it.
+ hint: Use -f if you really want to add them.
+ hint: Turn this message off by running
+ hint: "git config advice.addIgnoredFile false"
EOF
# Does not use test_commit due to the ignore
echo "*" > .gitignore &&
@@ -191,6 +208,17 @@ test_expect_success 'submodule add to reconfigure existing submodule with --forc
)
'
+test_expect_success 'submodule add relays add --dry-run stderr' '
+ test_when_finished "rm -rf addtest/.git/index.lock" &&
+ (
+ cd addtest &&
+ : >.git/index.lock &&
+ ! git submodule add "$submodurl" sub-while-locked 2>output.err &&
+ test_i18ngrep "^fatal: .*index\.lock" output.err &&
+ test_path_is_missing sub-while-locked
+ )
+'
+
test_expect_success 'submodule add --branch' '
echo "refs/heads/initial" >expect-head &&
cat <<-\EOF >expect-heads &&
@@ -399,6 +427,14 @@ test_expect_success 'init should register submodule url in .git/config' '
test_cmp expect url
'
+test_expect_success 'status should still be "missing" after initializing' '
+ rm -fr init &&
+ mkdir init &&
+ git submodule status >lines &&
+ rm -fr init &&
+ grep "^-$rev1" lines
+'
+
test_failure_with_unknown_submodule () {
test_must_fail git submodule $1 no-such-submodule 2>output.err &&
test_i18ngrep "^error: .*no-such-submodule" output.err