summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-04-05 14:15:13 -0700
committerJunio C Hamano <gitster@pobox.com>2013-04-05 14:15:13 -0700
commit7b72ec5e14656af2d48c7a2a0b7251c35903bbaf (patch)
tree256a8fc8eaba0b2b22f0853d88ecba58d7c5f04f
parentcb660275789973aa56128b3fbbda4bdff270572a (diff)
parent7b294bf4948931a915cee2d5a692235e9b9c0e27 (diff)
downloadgit-7b72ec5e14656af2d48c7a2a0b7251c35903bbaf.tar.gz
Merge branch 'jl/submodule-deinit'
A finishing touch to the new topic in 1.8.3. * jl/submodule-deinit: submodule deinit: clarify work tree removal message
-rwxr-xr-xgit-submodule.sh6
-rwxr-xr-xt/t7400-submodule-basic.sh21
2 files changed, 20 insertions, 7 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 275c664ff5..79bfaac9d4 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -606,10 +606,12 @@ cmd_deinit()
if test -z "$force"
then
- git rm -n "$sm_path" ||
+ git rm -qn "$sm_path" ||
die "$(eval_gettext "Submodule work tree '\$sm_path' contains local modifications; use '-f' to discard them")"
fi
- rm -rf "$sm_path" || say "$(eval_gettext "Could not remove submodule work tree '\$sm_path'")"
+ rm -rf "$sm_path" &&
+ say "$(eval_gettext "Cleared directory '\$sm_path'")" ||
+ say "$(eval_gettext "Could not remove submodule work tree '\$sm_path'")"
fi
mkdir "$sm_path" || say "$(eval_gettext "Could not create empty submodule directory '\$sm_path'")"
diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 5030f1f1bc..ff265353a3 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -777,18 +777,22 @@ test_expect_success 'submodule deinit . deinits all initialized submodules' '
git config submodule.example.foo bar &&
git config submodule.example2.frotz nitfol &&
test_must_fail git submodule deinit &&
- git submodule deinit . &&
+ git submodule deinit . >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 &&
- git submodule deinit init example2 &&
+ git submodule deinit init example2 >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
'
@@ -798,8 +802,9 @@ test_expect_success 'submodule deinit fails when the submodule contains modifica
test_must_fail git submodule deinit init &&
test -n "$(git config --get-regexp "submodule\.example\.")" &&
test -f example2/.git &&
- git submodule deinit -f init &&
+ git submodule deinit -f init >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
+ test_i18ngrep "Cleared directory .init" actual &&
rmdir init
'
@@ -809,8 +814,9 @@ test_expect_success 'submodule deinit fails when the submodule contains untracke
test_must_fail git submodule deinit init &&
test -n "$(git config --get-regexp "submodule\.example\.")" &&
test -f example2/.git &&
- git submodule deinit -f init &&
+ git submodule deinit -f init >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
+ test_i18ngrep "Cleared directory .init" actual &&
rmdir init
'
@@ -823,8 +829,9 @@ test_expect_success 'submodule deinit fails when the submodule HEAD does not mat
test_must_fail git submodule deinit init &&
test -n "$(git config --get-regexp "submodule\.example\.")" &&
test -f example2/.git &&
- git submodule deinit -f init &&
+ git submodule deinit -f init >actual &&
test -z "$(git config --get-regexp "submodule\.example\.")" &&
+ test_i18ngrep "Cleared directory .init" actual &&
rmdir init
'
@@ -832,14 +839,18 @@ test_expect_success 'submodule deinit is silent when used on an uninitialized su
git submodule update --init &&
git submodule deinit init >actual &&
test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual &&
+ test_i18ngrep "Cleared directory .init" actual &&
git submodule deinit init >actual &&
test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
+ test_i18ngrep "Cleared directory .init" actual &&
git submodule deinit . >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 &&
git submodule deinit . >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
'