Merge branch 'ao/submodule-wo-gitmodules-checked-out'
The submodule support has been updated to read from the blob at HEAD:.gitmodules when the .gitmodules file is missing from the working tree. * ao/submodule-wo-gitmodules-checked-out: t/helper: add test-submodule-nested-repo-config submodule: support reading .gitmodules when it's not in the working tree submodule: add a helper to check if it is safe to write to .gitmodules t7506: clean up .gitmodules properly before setting up new scenario submodule: use the 'submodule--helper config' command submodule--helper: add a new 'config' subcommand t7411: be nicer to future tests and really clean things up t7411: merge tests 5 and 6 submodule: factor out a config_set_in_gitmodules_file_gently function submodule: add a print_config_from_gitmodules() helper
This commit is contained in:
@ -72,7 +72,7 @@ get_submodule_config () {
|
||||
value=$(git config submodule."$name"."$option")
|
||||
if test -z "$value"
|
||||
then
|
||||
value=$(git config -f .gitmodules submodule."$name"."$option")
|
||||
value=$(git submodule--helper config submodule."$name"."$option")
|
||||
fi
|
||||
printf '%s' "${value:-$default}"
|
||||
}
|
||||
@ -164,6 +164,11 @@ cmd_add()
|
||||
shift
|
||||
done
|
||||
|
||||
if ! git submodule--helper config --check-writeable >/dev/null 2>&1
|
||||
then
|
||||
die "$(eval_gettext "please make sure that the .gitmodules file is in the working tree")"
|
||||
fi
|
||||
|
||||
if test -n "$reference_path"
|
||||
then
|
||||
is_absolute_path "$reference_path" ||
|
||||
@ -288,11 +293,11 @@ or you are unsure what this means choose another name with the '--name' option."
|
||||
git add --no-warn-embedded-repo $force "$sm_path" ||
|
||||
die "$(eval_gettext "Failed to add submodule '\$sm_path'")"
|
||||
|
||||
git config -f .gitmodules submodule."$sm_name".path "$sm_path" &&
|
||||
git config -f .gitmodules submodule."$sm_name".url "$repo" &&
|
||||
git submodule--helper config submodule."$sm_name".path "$sm_path" &&
|
||||
git submodule--helper config submodule."$sm_name".url "$repo" &&
|
||||
if test -n "$branch"
|
||||
then
|
||||
git config -f .gitmodules submodule."$sm_name".branch "$branch"
|
||||
git submodule--helper config submodule."$sm_name".branch "$branch"
|
||||
fi &&
|
||||
git add --force .gitmodules ||
|
||||
die "$(eval_gettext "Failed to register submodule '\$sm_path'")"
|
||||
|
||||
Reference in New Issue
Block a user