X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=t%2Ft7400-submodule-basic.sh;h=9bda97058499ecab88dc6de7551d7909e1ad5a2e;hb=452c6d506b1a6dcf24d4ceaa592afc39c1c1a60e;hp=97ff074da768cbf3418f22b366ff935d82915f85;hpb=c9eaaab4165d8f402930d12899ec097495b599e6;p=git.git diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 97ff074da..9bda97058 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -42,7 +42,8 @@ test_expect_success 'setup - hide init subdirectory' ' ' test_expect_success 'setup - repository to add submodules to' ' - git init addtest + git init addtest && + git init addtest-ignore ' # The 'submodule add' tests need some repository to add as a submodule. @@ -85,6 +86,30 @@ test_expect_success 'submodule add' ' test_cmp empty untracked ' +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 >actual 2>&1 && + test_cmp expect actual + ) +' + +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' ' echo "refs/heads/initial" >expect-head && cat <<-\EOF >expect-heads &&