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>
This commit is contained in:
parent
efa8fd7ee8
commit
a2aed08b41
@ -803,17 +803,10 @@ cmd_update()
|
|||||||
update_module=$update
|
update_module=$update
|
||||||
else
|
else
|
||||||
update_module=$(git config submodule."$name".update)
|
update_module=$(git config submodule."$name".update)
|
||||||
case "$update_module" in
|
if test -z "$update_module"
|
||||||
'')
|
then
|
||||||
;; # Unset update mode
|
update_module="checkout"
|
||||||
checkout | rebase | merge | none)
|
fi
|
||||||
;; # Known update modes
|
|
||||||
!*)
|
|
||||||
;; # Custom update command
|
|
||||||
*)
|
|
||||||
die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
displaypath=$(relative_path "$prefix$sm_path")
|
displaypath=$(relative_path "$prefix$sm_path")
|
||||||
@ -882,11 +875,16 @@ Maybe you want to use 'update --init'?")"
|
|||||||
case ";$cloned_modules;" in
|
case ";$cloned_modules;" in
|
||||||
*";$name;"*)
|
*";$name;"*)
|
||||||
# then there is no local change to integrate
|
# then there is no local change to integrate
|
||||||
update_module= ;;
|
update_module=checkout ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
must_die_on_failure=
|
must_die_on_failure=
|
||||||
case "$update_module" in
|
case "$update_module" in
|
||||||
|
checkout)
|
||||||
|
command="git checkout $subforce -q"
|
||||||
|
die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
|
||||||
|
say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
|
||||||
|
;;
|
||||||
rebase)
|
rebase)
|
||||||
command="git rebase"
|
command="git rebase"
|
||||||
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
|
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
|
||||||
@ -906,10 +904,7 @@ Maybe you want to use 'update --init'?")"
|
|||||||
must_die_on_failure=yes
|
must_die_on_failure=yes
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
command="git checkout $subforce -q"
|
die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
|
||||||
die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
|
|
||||||
say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if (clear_local_git_env; cd "$sm_path" && $command "$sha1")
|
if (clear_local_git_env; cd "$sm_path" && $command "$sha1")
|
||||||
|
Loading…
Reference in New Issue
Block a user