Merge branch 'sb/submodule-deinit-all' into maint

Correct faulty recommendation to use "git submodule deinit ." when
de-initialising all submodules, which would result in a strange
error message in a pathological corner case.

* sb/submodule-deinit-all:
  submodule deinit: require '--all' instead of '.' for all submodules
This commit is contained in:
Junio C Hamano
2016-05-31 14:09:46 -07:00
3 changed files with 48 additions and 10 deletions

View File

@ -11,6 +11,10 @@ subcommands of git submodule.
. ./test-lib.sh
test_expect_success 'submodule deinit works on empty repository' '
git submodule deinit --all
'
test_expect_success 'setup - initial commit' '
>t &&
git add t &&
@ -899,7 +903,8 @@ test_expect_success 'submodule deinit works on repository without submodules' '
>file &&
git add file &&
git commit -m "repo should not be empty"
git submodule deinit .
git submodule deinit . &&
git submodule deinit --all
)
'
@ -941,6 +946,19 @@ test_expect_success 'submodule deinit . deinits all initialized submodules' '
rmdir init example2
'
test_expect_success 'submodule deinit --all deinits all initialized submodules' '
git submodule update --init &&
git config submodule.example.foo bar &&
git config submodule.example2.frotz nitfol &&
test_must_fail git submodule deinit &&
git submodule deinit --all >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
test -z "$(git config --get-regexp "submodule\.example2\.")" &&
test_i18ngrep "Cleared directory .init" actual &&
test_i18ngrep "Cleared directory .example2" actual &&
rmdir init example2
'
test_expect_success 'submodule deinit deinits a submodule when its work tree is missing or empty' '
git submodule update --init &&
rm -rf init example2/* example2/.git &&
@ -1007,6 +1025,10 @@ test_expect_success 'submodule deinit is silent when used on an uninitialized su
test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
test_i18ngrep "Cleared directory .init" actual &&
git submodule deinit --all >actual &&
test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
test_i18ngrep "Cleared directory .init" actual &&
rmdir init example2
'