diff options
author | Jens Lehmann <Jens.Lehmann@web.de> | 2010-07-17 17:11:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-07-19 11:10:43 -0700 |
commit | d27b876b284b8fb82db971bc7cea8c9782614ab2 (patch) | |
tree | 7b6b25de2e21825d8b728813c5bed0dee83c3542 /t | |
parent | 8fbe9b32ce6f5e12ba3f8b9d4e3ccb0b8acf529f (diff) | |
download | git-d27b876b284b8fb82db971bc7cea8c9782614ab2.tar.gz git-d27b876b284b8fb82db971bc7cea8c9782614ab2.tar.xz |
git submodule add: Require the new --force option to add ignored paths
To make the behavior of "git submodule add" more consistent with "git add"
ignored submodule paths should not be silently added when they match an
entry in a .gitignore file. To be able to override that default behavior
in the same way as we can do that for "git add", the new option "--force"
is introduced.
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t7400-submodule-basic.sh | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index d9f278599..9bda97058 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -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' ' |