diff options
author | Jens Lehmann <Jens.Lehmann@web.de> | 2013-04-01 21:02:00 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-01 13:05:54 -0700 |
commit | 7b294bf4948931a915cee2d5a692235e9b9c0e27 (patch) | |
tree | f3b480c3ac33ce25575dc87e3b86b29fc7b1cfb8 /git-submodule.sh | |
parent | cf419828064d4f22a2c3134e7b46a7719462b1dc (diff) | |
download | git-7b294bf4948931a915cee2d5a692235e9b9c0e27.tar.gz |
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-x | git-submodule.sh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index c1a3202d41..59ac86f345 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'")" |