diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-13 22:37:22 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-13 22:37:22 +0900 |
commit | abb4824d13a44f68d1bbaf6726945983230771f9 (patch) | |
tree | 316449048983aa8a4503af46cd450199a69b1078 /git-submodule.sh | |
parent | 504bdc59948831ebccafb1be9f90bb58c02303eb (diff) | |
parent | 2b1257e463fe97b3f657bbf30fafdea0c4847cd7 (diff) | |
download | git-abb4824d13a44f68d1bbaf6726945983230771f9.tar.gz |
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
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-x | git-submodule.sh | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/git-submodule.sh b/git-submodule.sh index c09eb3e03d..5e608f8bad 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -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'")" |