]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t7400-submodule-basic.sh
push: mention "git pull" in error message for non-fast forwards
[git.git] / t / t7400-submodule-basic.sh
index d9f27859932c33e126fa64c5c1fb80963dabb97a..9bda97058499ecab88dc6de7551d7909e1ad5a2e 100755 (executable)
@@ -86,25 +86,28 @@ test_expect_success 'submodule add' '
        test_cmp empty untracked
 '
 
-test_expect_success 'submodule add to .gitignored path' '
-       echo "refs/heads/master" >expect &&
-       >empty &&
-
+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:
+               submod
+               Use -f if you really want to add it.
+               EOF
                # Does not use test_commit due to the ignore
                echo "*" > .gitignore &&
                git add --force .gitignore &&
                git commit -m"Ignore everything" &&
-               git submodule add "$submodurl" submod &&
-               git submodule init
-       ) &&
+               ! git submodule add "$submodurl" submod >actual 2>&1 &&
+               test_cmp expect actual
+       )
+'
 
-       rm -f heads head untracked &&
-       inspect addtest/submod ../.. &&
-       test_cmp expect heads &&
-       test_cmp expect head &&
-       test_cmp empty untracked
+test_expect_success 'submodule add to .gitignored path with --force' '
+       (
+               cd addtest-ignore &&
+               git submodule add --force "$submodurl" submod
+       )
 '
 
 test_expect_success 'submodule add --branch' '