diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-05-31 14:09:46 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-31 14:09:46 -0700 |
commit | 3296e1a93a4540e083ffe28710d3601da95f06b5 (patch) | |
tree | 9e4a76051e275e004aeac60abaab164d8cb9abde /git-submodule.sh | |
parent | e646a82ce2828d6e8e3a18fe02dd9b3d31478f00 (diff) | |
parent | f6a527997743b79d6986a16313a7488cfc53d123 (diff) | |
download | git-3296e1a93a4540e083ffe28710d3601da95f06b5.tar.gz git-3296e1a93a4540e083ffe28710d3601da95f06b5.tar.xz |
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
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index 753a90d30..d56207ea0 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -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> @@ -521,6 +521,7 @@ cmd_init() cmd_deinit() { # parse $args after "submodule ... deinit". + deinit_all= while test $# -ne 0 do case "$1" in @@ -530,6 +531,9 @@ cmd_deinit() -q|--quiet) GIT_QUIET=1 ;; + --all) + deinit_all=t + ;; --) shift break @@ -544,9 +548,14 @@ cmd_deinit() shift done - if test $# = 0 + if test -n "$deinit_all" && test "$#" -ne 0 + then + echo >&2 "$(eval_gettext "pathspec and --all are incompatible")" + usage + fi + if test $# = 0 && test -z "$deinit_all" then - die "$(eval_gettext "Use '.' if you really want to deinitialize all submodules")" + die "$(eval_gettext "Use '--all' if you really want to deinitialize all submodules")" fi git submodule--helper list --prefix "$wt_prefix" "$@" | |