submodule: no [--merge|--rebase] when newly cloned
"git submodule update" can be run with either the "--merge" or "--rebase" option, or submodule.<name>.update configuration variable can be set to "merge" or "rebase, to cause local work to get integrated when updating the submodule. When a submodule is newly cloned, however, it does not have a check out when a rebase or merge is attempted, leading to a failure. For newly cloned submodules, simply check out the appropriate revision. There is no local work to integrate with for them. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7ed863a85a
commit
1b4735d9f3
@ -423,6 +423,7 @@ cmd_update()
|
|||||||
cmd_init "--" "$@" || return
|
cmd_init "--" "$@" || return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cloned_modules=
|
||||||
module_list "$@" |
|
module_list "$@" |
|
||||||
while read mode sha1 stage path
|
while read mode sha1 stage path
|
||||||
do
|
do
|
||||||
@ -442,6 +443,7 @@ cmd_update()
|
|||||||
if ! test -d "$path"/.git -o -f "$path"/.git
|
if ! test -d "$path"/.git -o -f "$path"/.git
|
||||||
then
|
then
|
||||||
module_clone "$path" "$url" "$reference"|| exit
|
module_clone "$path" "$url" "$reference"|| exit
|
||||||
|
cloned_modules="$cloned_modules;$name"
|
||||||
subsha1=
|
subsha1=
|
||||||
else
|
else
|
||||||
subsha1=$(clear_local_git_env; cd "$path" &&
|
subsha1=$(clear_local_git_env; cd "$path" &&
|
||||||
@ -469,6 +471,13 @@ cmd_update()
|
|||||||
die "Unable to fetch in submodule path '$path'"
|
die "Unable to fetch in submodule path '$path'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Is this something we just cloned?
|
||||||
|
case ";$cloned_modules;" in
|
||||||
|
*";$name;"*)
|
||||||
|
# then there is no local change to integrate
|
||||||
|
update_module= ;;
|
||||||
|
esac
|
||||||
|
|
||||||
case "$update_module" in
|
case "$update_module" in
|
||||||
rebase)
|
rebase)
|
||||||
command="git rebase"
|
command="git rebase"
|
||||||
|
Loading…
Reference in New Issue
Block a user