Merge branch 'sb/submodule-deinit-all'

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-17 14:38:19 -07:00
3 changed files with 48 additions and 10 deletions

View File

@ -8,7 +8,7 @@ dashless=$(basename "$0" | sed -e 's/-/ /')
USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: $dashless [--quiet] init [--] [<path>...]
or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
or: $dashless [--quiet] deinit [-f|--force] (--all| [--] <path>...)
or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--reference <repository>] [--recursive] [--] [<path>...]
or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: $dashless [--quiet] foreach [--recursive] <command>
@ -415,6 +415,7 @@ cmd_init()
cmd_deinit()
{
# parse $args after "submodule ... deinit".
deinit_all=
while test $# -ne 0
do
case "$1" in
@ -424,6 +425,9 @@ cmd_deinit()
-q|--quiet)
GIT_QUIET=1
;;
--all)
deinit_all=t
;;
--)
shift
break
@ -438,9 +442,14 @@ cmd_deinit()
shift
done
if test $# = 0
if test -n "$deinit_all" && test "$#" -ne 0
then
die "$(eval_gettext "Use '.' if you really want to deinitialize all submodules")"
echo >&2 "$(eval_gettext "pathspec and --all are incompatible")"
usage
fi
if test $# = 0 && test -z "$deinit_all"
then
die "$(eval_gettext "Use '--all' if you really want to deinitialize all submodules")"
fi
git submodule--helper list --prefix "$wt_prefix" "$@" |