Skip to content

Commit b2faad4

Browse files
ao2gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2502ffc commit b2faad4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git-submodule.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ get_submodule_config () {
7272
value=$(git config submodule."$name"."$option")
7373
if test -z "$value"
7474
then
75-
value=$(git config -f .gitmodules submodule."$name"."$option")
75+
value=$(git submodule--helper config submodule."$name"."$option")
7676
fi
7777
printf '%s' "${value:-$default}"
7878
}
@@ -283,11 +283,11 @@ or you are unsure what this means choose another name with the '--name' option."
283283
git add --no-warn-embedded-repo $force "$sm_path" ||
284284
die "$(eval_gettext "Failed to add submodule '\$sm_path'")"
285285

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" &&
288288
if test -n "$branch"
289289
then
290-
git config -f .gitmodules submodule."$sm_name".branch "$branch"
290+
git submodule--helper config submodule."$sm_name".branch "$branch"
291291
fi &&
292292
git add --force .gitmodules ||
293293
die "$(eval_gettext "Failed to register submodule '\$sm_path'")"

0 commit comments

Comments
 (0)