summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2013-04-01 19:02:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-01 20:05:54 (GMT)
commit7b294bf4948931a915cee2d5a692235e9b9c0e27 (patch)
treef3b480c3ac33ce25575dc87e3b86b29fc7b1cfb8 /git-submodule.sh
parentcf419828064d4f22a2c3134e7b46a7719462b1dc (diff)
downloadgit-7b294bf4948931a915cee2d5a692235e9b9c0e27.zip
git-7b294bf4948931a915cee2d5a692235e9b9c0e27.tar.gz
git-7b294bf4948931a915cee2d5a692235e9b9c0e27.tar.bz2
submodule deinit: clarify work tree removal message
The output of "git submodule deinit sub" of a populated submodule prints rm 'sub' as the first line unless used with the -f option. The "rm 'sub'" line is exactly the same output the user gets when using "git rm sub" (because that command is used with the --dry-run option under the hood to determine if the submodule is clean), which can easily lead to the false impression that the submodule would be permanently removed. Also users might be confused that the "rm 'submodule'" line won't show up when the -f option is used, as the test is skipped in this case. Silence the "rm 'submodule'" output by using the --quiet option for "git rm" and always print Cleared directory 'submodule' instead as the first output line. This line is printed as long as the directory exists, no matter if empty or not. Also extend the tests in t7400 to make sure the "Cleared directory" line is printed correctly. Reported-by: Phil Hord <phil.hord@gmail.com> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index c1a3202..59ac86f 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -570,10 +570,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'")"