submodule: use the 'submodule--helper config' command

Use the 'submodule--helper config' command in git-submodules.sh to avoid referring explicitly to .gitmodules by the hardcoded file path. This makes it possible to access the submodules configuration in a more controlled way. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Antonio Ospite committed Oct 5, 2018 at 15:05 UTC b2faad44e2686cb996b9bf2a2dd22f787fc05f16
1 file changed +4 -4
git-submodule.sh
+4 -4
@@ -72,7 +72,7 @@ get_submodule_config () {
72 value=$(git config submodule."$name"."$option")
73 if test -z "$value"
74 then
75 - value=$(git config -f .gitmodules submodule."$name"."$option")
75 + value=$(git submodule--helper config submodule."$name"."$option")
76 fi
77 printf '%s' "${value:-$default}"
78 }
@@ -283,11 +283,11 @@ or you are unsure what this means choose another name with the '--name' option."
283 git add --no-warn-embedded-repo $force "$sm_path" ||
284 die "$(eval_gettext "Failed to add submodule '\$sm_path'")"
285
286 - git config -f .gitmodules submodule."$sm_name".path "$sm_path" &&
287 - git config -f .gitmodules submodule."$sm_name".url "$repo" &&
286 + git submodule--helper config submodule."$sm_name".path "$sm_path" &&
287 + git submodule--helper config submodule."$sm_name".url "$repo" &&
288 if test -n "$branch"
289 then
290 - git config -f .gitmodules submodule."$sm_name".branch "$branch"
290 + git submodule--helper config submodule."$sm_name".branch "$branch"
291 fi &&
292 git add --force .gitmodules ||
293 die "$(eval_gettext "Failed to register submodule '\$sm_path'")"