diff options
author | Francesco Pretto <ceztko@gmail.com> | 2014-01-05 03:50:48 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-01-07 09:20:59 -0800 |
commit | efa8fd7ee8eb36df55b3549f6009f000347a796d (patch) | |
tree | c584a00d5e6afbab73184130330a2371cf5c83fd /git-submodule.sh | |
parent | b9cf14d43b221fc2cce07b63d1dca408c17946e3 (diff) | |
download | git-efa8fd7ee8eb36df55b3549f6009f000347a796d.tar.gz |
git-submodule.sh: 'checkout' is a valid update modefp/submodule-checkout-mode
'checkout' is documented as one of the valid values for the
'submodule.<name>.update' variable, and in a repository with the
variable set to 'checkout', "git submodule update" command does
update using the 'checkout' mode.
However, it has been an accident that the implementation works this
way; any unknown value would trigger the same codepath and update
using the 'checkout' mode.
Explicitly list 'checkout' as one of the known update modes, and
error out when an unknown update mode is used.
Teach the codepath that initializes the configuration variable from
an in-tree .gitmodules that 'checkout' is one of the valid values.
The code since ac1fbbda (submodule: do not copy unknown update mode
from .gitmodules, 2013-12-02) used to treat the value 'checkout' as
unknown and mapped it to 'none', which made little sense. With this
change, 'checkout' specified in .gitmodules will stay to be 'checkout'.
Signed-off-by: Francesco Pretto <ceztko@gmail.com>
Signed-off-by: Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index 66f5f752c5..5247f78f35 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -617,7 +617,7 @@ cmd_init() test -z "$(git config submodule."$name".update)" then case "$upd" in - rebase | merge | none) + checkout | rebase | merge | none) ;; # known modes of updating *) echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'" @@ -803,6 +803,17 @@ cmd_update() update_module=$update else update_module=$(git config submodule."$name".update) + case "$update_module" in + '') + ;; # Unset update mode + checkout | rebase | merge | none) + ;; # Known update modes + !*) + ;; # Custom update command + *) + die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")" + ;; + esac fi displaypath=$(relative_path "$prefix$sm_path") |