Merge branch 'so/submodule-no-update-first-time' into maint
* so/submodule-no-update-first-time: t7406: "git submodule update {--merge|--rebase]" with new submodules submodule: no [--merge|--rebase] when newly cloned
This commit is contained in:
commit
106040fe8e
@ -423,6 +423,7 @@ cmd_update()
|
||||
cmd_init "--" "$@" || return
|
||||
fi
|
||||
|
||||
cloned_modules=
|
||||
module_list "$@" |
|
||||
while read mode sha1 stage path
|
||||
do
|
||||
@ -442,6 +443,7 @@ cmd_update()
|
||||
if ! test -d "$path"/.git -o -f "$path"/.git
|
||||
then
|
||||
module_clone "$path" "$url" "$reference"|| exit
|
||||
cloned_modules="$cloned_modules;$name"
|
||||
subsha1=
|
||||
else
|
||||
subsha1=$(clear_local_git_env; cd "$path" &&
|
||||
@ -469,6 +471,13 @@ cmd_update()
|
||||
die "Unable to fetch in submodule path '$path'"
|
||||
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
|
||||
rebase)
|
||||
command="git rebase"
|
||||
|
@ -203,4 +203,56 @@ test_expect_success 'submodule init picks up merge' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update --merge - ignores --merge for new submodules' '
|
||||
(cd super &&
|
||||
rm -rf submodule &&
|
||||
git submodule update submodule &&
|
||||
git status -s submodule >expect &&
|
||||
rm -rf submodule &&
|
||||
git submodule update --merge submodule &&
|
||||
git status -s submodule >actual &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update --rebase - ignores --rebase for new submodules' '
|
||||
(cd super &&
|
||||
rm -rf submodule &&
|
||||
git submodule update submodule &&
|
||||
git status -s submodule >expect &&
|
||||
rm -rf submodule &&
|
||||
git submodule update --rebase submodule &&
|
||||
git status -s submodule >actual &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update ignores update=merge config for new submodules' '
|
||||
(cd super &&
|
||||
rm -rf submodule &&
|
||||
git submodule update submodule &&
|
||||
git status -s submodule >expect &&
|
||||
rm -rf submodule &&
|
||||
git config submodule.submodule.update merge &&
|
||||
git submodule update submodule &&
|
||||
git status -s submodule >actual &&
|
||||
git config --unset submodule.submodule.update &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update ignores update=rebase config for new submodules' '
|
||||
(cd super &&
|
||||
rm -rf submodule &&
|
||||
git submodule update submodule &&
|
||||
git status -s submodule >expect &&
|
||||
rm -rf submodule &&
|
||||
git config submodule.submodule.update rebase &&
|
||||
git submodule update submodule &&
|
||||
git status -s submodule >actual &&
|
||||
git config --unset submodule.submodule.update &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user