submodule: make 'checkout' update_module mode more explicit

This avoids the current awkwardness of having either '' or 'checkout' for checkout-mode updates, which makes testing for checkout-mode updates (or non-checkout-mode updates) easier. Signed-off-by: W. Trevor King <wking@tremily.us> Signed-off-by: Junio C Hamano <gitster@pobox.com>

W. Trevor King committed Jan 15, 2014 at 20:10 UTC a2aed08b4152921d5651e42c09c8945a259e3443
1 file changed +11 -16
git-submodule.sh
+11 -16
@@ -803,17 +803,10 @@ cmd_update()
803 update_module=$update
804 else
805 update_module=$(git config submodule."$name".update)
806 - case "$update_module" in
807 - '')
808 - ;; # Unset update mode
809 - checkout | rebase | merge | none)
810 - ;; # Known update modes
811 - !*)
812 - ;; # Custom update command
813 - *)
814 - die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
815 - ;;
816 - esac
806 + if test -z "$update_module"
807 + then
808 + update_module="checkout"
809 + fi
810 fi
811
812 displaypath=$(relative_path "$prefix$sm_path")
@@ -882,11 +875,16 @@ Maybe you want to use 'update --init'?")"
875 case ";$cloned_modules;" in
876 *";$name;"*)
877 # then there is no local change to integrate
885 - update_module= ;;
878 + update_module=checkout ;;
879 esac
880
881 must_die_on_failure=
882 case "$update_module" in
883 + checkout)
884 + command="git checkout $subforce -q"
885 + die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
886 + say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
887 + ;;
888 rebase)
889 command="git rebase"
890 die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
@@ -906,10 +904,7 @@ Maybe you want to use 'update --init'?")"
904 must_die_on_failure=yes
905 ;;
906 *)
909 - command="git checkout $subforce -q"
910 - die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
911 - say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
912 - ;;
907 + die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
908 esac
909
910 if (clear_local_git_env; cd "$sm_path" && $command "$sha1")