From: Junio C Hamano Date: Fri, 17 Jan 2014 20:21:20 +0000 (-0800) Subject: Merge branch 'fp/submodule-checkout-mode' X-Git-Tag: v1.9-rc0~2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1aeb10a14d5ecf5a10a4536b873c9feb244a7848?hp=-c Merge branch 'fp/submodule-checkout-mode' "submodule.*.update=checkout", when propagated from .gitmodules to .git/config, turned into a "submodule.*.update=none", which did not make much sense. * fp/submodule-checkout-mode: git-submodule.sh: 'checkout' is a valid update mode --- 1aeb10a14d5ecf5a10a4536b873c9feb244a7848 diff --combined git-submodule.sh index 2677f2e8b3,5247f78f35..4a30087768 --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -156,7 -156,7 +156,7 @@@ module_list( git ls-files -z --error-unmatch --stage -- "$@" || echo "unmatched pathspec exists" ) | - perl -e ' + @@PERL@@ -e ' my %unmerged = (); my ($null_sha1) = ("0" x 40); my @out = (); @@@ -545,12 -545,7 +545,12 @@@ cmd_foreach( sm_path=$(relative_path "$sm_path") && # we make $path available to scripts ... path=$sm_path && - eval "$@" && + if test $# -eq 1 + then + eval "$1" + else + "$@" + fi && if test -n "$recursive" then cmd_foreach "--recursive" "$@" @@@ -622,7 -617,7 +622,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'" @@@ -721,6 -716,7 +721,6 @@@ cmd_deinit( cmd_update() { # parse $args after "submodule ... update". - orig_flags= while test $# -ne 0 do case "$1" in @@@ -745,6 -741,7 +745,6 @@@ --reference) case "$2" in '') usage ;; esac reference="--reference=$2" - orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")" shift ;; --reference=*) @@@ -778,6 -775,7 +778,6 @@@ break ;; esac - orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")" shift done @@@ -805,6 -803,17 +805,17 @@@ 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") @@@ -921,7 -930,7 +932,7 @@@ Maybe you want to use 'update --init'?" prefix="$prefix$sm_path/" clear_local_git_env cd "$sm_path" && - eval cmd_update "$orig_flags" + eval cmd_update ) res=$? if test $res -gt 0